Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQLSTATE / SQLCODE

29 views
Skip to first unread message

Jean-Marc Blaise

unread,
Jun 15, 2004, 2:03:20 PM6/15/04
to
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


Mark A

unread,
Jun 15, 2004, 3:03:46 PM6/15/04
to
"Jean-Marc Blaise" <nob...@nowhere.com> wrote in message
news:candk0$7fn$1...@news-reader1.wanadoo.fr...
You can use the -e option on the CLP to request the SQLCODE or SQLSTATE. See
the Command Reference manual for details.


Serge Rielau

unread,
Jun 15, 2004, 2:55:41 PM6/15/04
to
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

Jean-Marc Blaise

unread,
Jun 15, 2004, 7:10:19 PM6/15/04
to
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" <sri...@ca.eye-be-em.com> a écrit dans le message de
news:cangnn$h9g$1...@hanover.torolab.ibm.com...

Serge Rielau

unread,
Jun 16, 2004, 1:10:55 AM6/16/04
to
Duly noted. Don't expect a fix in Stinger though.

Douglas Doole

unread,
Jun 23, 2004, 2:38:50 PM6/23/04
to
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/db2/udb/winos2unix/support

0 new messages