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.
Roger Tomas — — source: Informix-list mailing list archive (1991-1998)
The stored procedure language RAISE EXCEPTION statement
allows you to specify an error message string. But the
description of the RAISE EXCEPTION statement in the
Stored Procedures section of the Informix Guide to SQL
Reference (5.0) does not say anything about how this
message is/can be used. I need to get these message
into my ESQL/C applications.
Through experimentation, I have been able to determine
that the message is placed into sqlca.sqlerrm. So I
now have access to the message. I need only determine
when to look at the sqlerrm field and when to pass the
sqlcode to the rgetmsg function to get the message.
I've decided to do this by having the stored procedures
always return an error code like -9999 and have my
applications check for this code to determine where to
get the error message from. This works but I have two
concerns:
(1) This capability doesn't seem to be documented
anywhere so it might not exist in the next
version we migrate to.
(2) If I reuse an sqlcode already being used by
Informix, I will interpret occurrences of
the corresponding Informix error as a stored
procedure-generated error.
Anyone know if there is a better way to do this? Is
this the correct way? Is, this the only way? Is it
supported?
By the way, the stored procedures are invoked via
triggers so there's no opportunity for the procedures
to simply return the error message using the RETURN
statement.
Thanks in advance for any help.
Roger Tomas
AG Communication Systems
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.