Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Andreas Schubert wrote:
>
> Is there a way to get by SELECT statement the content of SQLERRD[2] -- the
> generated serial number after INSERT? (not in ESQL environment, must be
> single SQL query).
> Thanx.
> --
> ,,Perfection is achieved only in the point of collapse." (C.N.Parkinson)
>
> Andreas Schubert, mailto:aschub@sax.sax.de
I don't exactly know what you mean with 'must be single SQL query'.
I would suggest writing a SPL-Procedure which calls the DBINFO function
after the INSERT, so it may look like:
CREATE PROCEDURE insert_return_serial (perhaps_many_parameters)
RETURNING INT; DEFINE serial_number INT;
INSERT INTO table_with_a_serial VALUES (all_the_parameters); LET serial_number = DBINFO ('sqlca.sqlerrd2');
RETURN serial_number;
END PROCEDURE;
Gottfried.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gottfried Schwieters (schwiete@quantum.de)
Quantum Gesellschaft fuer Software mbH
Emil-Figge-Strasse 83 ** D-44227 Dortmund ** Germany
'$c$?'}][ signature fault - core dumped
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.