If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > identifying queries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-04-04, 17:15
HEnuff HEnuff is offline
Registered User
 
Join Date: Mar 2004
Posts: 2
Question identifying queries

QUERYNO allows you to set the query number used when identifying a SQL statement. If you don't code QUERYNO the preprocessor assigns the line number of the statement. Is there any way to retrieve the query number assigned to the statment after it has executed?

IBM OS/390 DB2 V7



Jeff
Reply With Quote
  #2 (permalink)  
Old 03-04-04, 18:45
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
If you use the explain yes on the bind, it will be populated in the plan_table. You can retrieve it by APPLNAME (plan) and/or PROGNAME (program or package). The plan_table only gets updated at bind time for static SQL.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 03-05-04, 08:56
HEnuff HEnuff is offline
Registered User
 
Join Date: Mar 2004
Posts: 2
thanks

I had hoped to be able to retrieve the QUERYNO immediately after I had executed the SELECT, FETCH, etc so that I would know what statement I had just executed if I got a negative sqlcode and abended my program. Your suggestion would only give me a list of all the SQL statements I had in the program not which one I just executed.


thanks


jeff
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On