Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Question Unanswered: 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

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •