Tags: database, db2, dear, explain, ltsqlcodegt, messages, mysql, oracle, original, possess, sql, sqlcode, sqlstate, transmitting

SQLSTATE / SQLCODE

On Database » DB2

3,424 words with 5 Comments; publish: Sun, 30 Dec 2007 23:48:00 GMT; (250113.28, « »)

Dear all,

Could you explain why some SQL messages do not possess a SQLSTATE ?

Why not transmitting the SQLSTATE of the original <sqlcode>, for example if

you get a -911 on a RUNSTATS ?

SQL2310N The utility could not generate statistics. Error

"<sqlcode>" was returned.

Thanks,

JM

All Comments

Leave a comment...

  • 5 Comments
    • "Jean-Marc Blaise" <nobody.db2.questionfor.info.nowhere.com> wrote in message

      news:candk0$7fn$1.db2.questionfor.info.news-reader1.wanadoo.fr...

      > Dear all,

      > Could you explain why some SQL messages do not possess a SQLSTATE ?

      > Why not transmitting the SQLSTATE of the original <sqlcode>, for example

      if

      > you get a -911 on a RUNSTATS ?

      > SQL2310N The utility could not generate statistics. Error

      > "<sqlcode>" was returned.

      > Thanks,

      > JM

      You can use the -e option on the CLP to request the SQLCODE or SQLSTATE. See

      the Command Reference manual for details.

      #1; Sun, 30 Dec 2007 23:49:00 GMT
    • Jean-Marc,

      Can you calirify? Do you want

      SQL2310N The utility could not generate statistics. Error

      "<sqlcode>" _with_SQLSTATE_"<sqlstate>"_ was returned.

      or

      SQL2310N The utility could not generate statistics. Error

      "<sqlcode>" was returned.

      _SQLSTATE=xxxxx_

      Cheers

      Serge

      --

      Serge Rielau

      DB2 SQL Compiler Development

      IBM Toronto Lab

      #2; Sun, 30 Dec 2007 23:50:00 GMT
    • Hi Serge,

      It would be more like:

      SQL2310N The utility could not generate statistics. Error

      "<sqlcode>" was returned.

      _SQLSTATE=xxxxx_

      The RUNSTATS error seems to be sometimes SQL2310N or another code (without

      SQLSTATE), other times you could get a SQLCODE and SQLSTATE (at least in V7

      ... I was trapping SQLSTATEs in shell scripts and realized I only got

      SQLCODEs, so missed some info).

      But why such a difference as below - can you give a rule of SQLCODEs with or

      without SQLSTATEs ?

      * RUNSTATS ON TABLE DB2ADMIN.TITI gives:

      SQL2306N The table or index "DB2ADMIN.TITI" does not exist. (no SQLSTATE)

      * SELECT * FROM DB2ADMIN.TITI gives:

      SQL0204N "DB2ADMIN.TITI" is an undefined name. SQLSTATE=42704

      Cheers,

      Jean-Marc

      "Serge Rielau" <srielau.db2.questionfor.info.ca.eye-be-em.com> a crit dans le message de

      news:cangnn$h9g$1.db2.questionfor.info.hanover.torolab.ibm.com...

      > Jean-Marc,

      > Can you calirify? Do you want

      > SQL2310N The utility could not generate statistics. Error

      > "<sqlcode>" _with_SQLSTATE_"<sqlstate>"_ was returned.

      > or

      > SQL2310N The utility could not generate statistics. Error

      > "<sqlcode>" was returned.

      > _SQLSTATE=xxxxx_

      > Cheers

      > Serge

      > --

      > Serge Rielau

      > DB2 SQL Compiler Development

      > IBM Toronto Lab

      #3; Sun, 30 Dec 2007 23:51:00 GMT
    • Duly noted. Don't expect a fix in Stinger though.

      Cheers

      Serge

      --

      Serge Rielau

      DB2 SQL Compiler Development

      IBM Toronto Lab

      #4; Sun, 30 Dec 2007 23:52:00 GMT
    • The general rule is that SQL statements (everything in the SQL reference)

      will return errors with SQLSTATEs whereas commands and utilities

      (everything not in the SQL Reference) will not have SQLSTATEs.

      --

      __________________________________________________ ___________________

      Doug Doole

      DB2 Universal Database Development

      IBM Toronto Lab

      Visit the DB2 UDB and DB2 Connect Online Support site at:

      http://www.ibm.com/software/data/db...os2unix/support

      #5; Sun, 30 Dec 2007 23:53:00 GMT