The SQLCA structure is populated with the returns for the embedded
statement, which is why SQLSTATE returns 09000. I think the underlying
error can be parsed from SQLERM (SQL trigger &1 in &2 failed with
SQLCODE &3 SQLSTATE &4).
Tom Armbruster
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of RNewton@xxxxxxxxxxxx
Sent: Friday, January 18, 2008 7:57 AM
To: RPG programming on the AS400 / iSeries
Subject: RPG Getting SQLCODE for Trigger's RAISE_ERROR
Hi all,
I have created a before insert trigger that performs a RAISE_ERROR
setting
the SQLSTATE and message when a certain validation fails. This is
working
fine, however when I call the insert statement from embedded RPG, I
cannot
figure a way to get at the SQLSTATE value that I have the trigger
returning
in the event of an error. SQLCA's SQLSTATE always has value 0900
effectively overlaying the error that I raised.
Do any of you know how to get at the error that is raised by RAISE_ERROR
when using embeded SQL in RPG?
Thanks,
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx
This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the
employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.