Home » SQL & PL/SQL » SQL & PL/SQL » Using Case in Cursor
Using Case in Cursor [message #426930] Tue, 20 October 2009 06:28 Go to next message
ramr_Sw
Messages: 31
Registered: October 2009
Member
While I am trying to use case in Cursor begin part,It s throwing error

declare
cursor c10 is
begin
for x in c10 loop
case
when ..then

when ...then

else

end
end loop
end

for the above sample code,it s throwing "encountered the symbol end when expecting one of the following case"

pls help me

thanks in advance



Re: Using Case in Cursor [message #426931 is a reply to message #426930] Tue, 20 October 2009 06:29 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Post the actual code. Nothing can be garnered from what you have posted.
Re: Using Case in Cursor [message #426933 is a reply to message #426930] Tue, 20 October 2009 06:35 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
In the code you've posted, you've forgotten to provide an SQL query for the definition of cursor C10
Re: Using Case in Cursor [message #426935 is a reply to message #426930] Tue, 20 October 2009 06:35 Go to previous messageGo to next message
balakrishnay
Messages: 54
Registered: September 2009
Location: Pune
Member
Hi,

Try using temporary variable.

temp:= '... '

It should work.

Regards

Bala

[Updated on: Tue, 20 October 2009 06:36]

Report message to a moderator

Re: Using Case in Cursor [message #426939 is a reply to message #426935] Tue, 20 October 2009 06:40 Go to previous messageGo to next message
ramr_Sw
Messages: 31
Registered: October 2009
Member
Hi Bala

Pls let me know at what place do i need to use temp variable?

do i need to use it in case condition?

thanks
Re: Using Case in Cursor [message #426946 is a reply to message #426930] Tue, 20 October 2009 06:45 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
A CASE statement ends with END CASE not END alone.

Regards
Michel
Re: Using Case in Cursor [message #426949 is a reply to message #426946] Tue, 20 October 2009 06:50 Go to previous messageGo to next message
ramr_Sw
Messages: 31
Registered: October 2009
Member
Hi michal

It s working..thanks a ton
Re: Using Case in Cursor [message #426971 is a reply to message #426935] Tue, 20 October 2009 07:50 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
balakrishnay wrote on Tue, 20 October 2009 07:35
Hi,

Try using temporary variable.

temp:= '... '

It should work.

Regards

Bala


Surely it cannot be THIS question that the answer was for.
Previous Topic: Detemine table is big or small
Next Topic: Error while creating view in oracle 11g
Goto Forum:
  


Current Time: Fri Dec 02 18:20:54 CST 2016

Total time taken to generate the page: 0.22704 seconds