Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Declare two cursors in one declaration statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Declare two cursors in one declaration statement
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    Post subject: Re: Declare two cursors in one declaration statement
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

Site Director


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

PostPosted: Tue Mar 06, 2007 1:46 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us