Hi Vern,

Btw, congratulations on your new job!

One of the problems with all this SqlState discussion is what is an "SQL statement" in SQL P/L?

In Martijn van Breden's original code,

    if SqlState = '02000'  then

the logical expression (SQLSTATE = '02000') is apparently considered an SQL statement.

If the logical expression was (MyVar1 = MyVar2), would that be an SQL statement that changes SQLSTATE?

--
*Peter Dow* /
909 793-9050
petercdow@xxxxxxxxx
/

On 2/28/2025 5:49 AM, Vern Hamberg via MIDRANGE-L wrote:
Hi Daniel

The term "return code" is used in the SQL reference to describe what SQLSTATE and SQLCODE are -for example, from the manual at https://www.ibm.com/docs/en/ssw_ibm_i_75/pdf/rzalapdf.pdf

An SQLCODE is a return code. The return code is sent by the database manager after completion of each SQL statement.

An SQLSTATE value is a return code that indicates the outcome of the most recently executed SQL statement.

And in the SQL Reference is this interesting sentence -

    When an SQL statement other than GET DIAGNOSTICS or compound-statement is processed, the current diagnostics area is cleared, before processing the SQL statement.

Is a 2nd execution of GET DIAGNOSTICS going to give the same reported values? It doesn't clear the diagnostics area, so I expect it should still give the same information.

We might be saying the same thing in different ways, as someone says, agreeing violently!

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.