IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Declare two cursors in one declaration statement


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
palas_08
Currently Banned

New User


Joined: 26 Feb 2007
Posts: 9
Location: kolkatta

PostPosted: Mon Mar 05, 2007 3:32 pm
Reply with quote

hi ,


is it possible to declare two cursors in one declaration statements ?


i.e


exec sql

declare curser <curser name1> ,<cursername2>,<cursername3>

select * from table


end-exec


this declaration is true or wrong ?
thanks & regrads

palas
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Tue Mar 06, 2007 1:19 am
Reply with quote

I guess The program will not compile successfully.

Maybe you could just try it out?!!.

Dinesh.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Mar 06, 2007 1:46 am
Reply with quote

Hello,

Even if it would compile, why? icon_confused.gif

Not a good idea to name the "same" thing different names.
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Mar 06, 2007 3:04 pm
Reply with quote

Why compile though..? It should be at precompile.
You cannot do that because it violates the SYNTAX of DECLARE CURSOR.

In the above example you are not trying to declare two cursors. You are just trying to give 3 different names to the same SELECT statement.
The cursor name has to be unique. In embedded SQL there can only one VALID SQL statement between EXEC SQL & delimiter (could be END EXEC,; etc depending on the host language). Hope this helps..!! Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Positioned Deletes/Updates using curs... DB2 3
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts process statement for SUPREC, CMPCOLM... TSO/ISPF 4
No new posts SYNCSORT/ICETOOL JOINKEYS SORT Statem... DFSORT/ICETOOL 13
Search our Forums:

Back to Top