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

usage of select * in cursor and group variable in fetch


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

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Jul 15, 2009 7:49 pm
Reply with quote

Hello

I am using the following code in my program. Please suggest whether it will work fine. I dont have option to run it in a mainframe so asking here..

cursor decclaration.:

EXEC SQL
DECLARE CRS-MIFIDTRADING CURSOR WITH HOLD FOR
SELECT *
FROM
TGOVMIFIDTRADING
WHERE
INSTRUMENTID = : WS-INSTRUMENTID
END-EXEC.


and fetching it in this way..

EXEC SQL
FETCH CRS-MIFIDTRADING
INTO :DCLTGOVMIFIDTRADING
END-EXEC

DCLTGOVMIFIDTRADING is the dclgen variable. (group variable)

Can I use the select * and the DCLGEN 01 level variable for fetching?

Regards
Rohit
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 15, 2009 8:22 pm
Reply with quote

I don't know, don't have time to access my mainframe,
never used it since it is such a stupid thing to do.

But there is a 'button' at the top of this page: MANUALS.

you probably will find that a DB2 programmers guide or reference manual would have something to say about using * in the SELECT phrase for a CURSOR.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Thu Jul 16, 2009 11:43 am
Reply with quote

HI Rohit,
I will work fine but its always been advisable to use the column name instead of using select * and also while fetching you should use all the variable name in which you fetching the records.

Regards
Ketan varhade
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Fetch data from programs execute (dat... DB2 3
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts SELECT from data change table DB2 5
Search our Forums:

Back to Top