Subject | Check update succeeded |
---|---|
Author | flipmooooo |
Post date | 2005-02-10T09:12:33Z |
Hi,
- How can i check if an update is succeeded? I have to update a
single row, if the row doesn't exist i have to raise an exception. I
tried checking SQLCCODE after the updates 'WHEN SQLCODE 100' but that
didn't workout. Or do i have to do 'IF (EXISTS (SELECT 1 FROM ...
WHERE ...) prior to doing the update?
- How can i get hold of the changed exception messagetext in a 'WHEN
EXCEPTION' block for logging purposes.
BEGIN
...
...
if ... then
EXCEPTION BAD_ENTRY 'Not good'; <-------
...
...
if ... then
EXCEPTION BAD_ENTRY 'Better but still not right'; <-------
...
...
END
WHEN EXCEPTION BAD_ENTRY DO
BEGIN
/* 'Not good' or 'Better but still not right' */
INSERT LOG (...,MessageText,...)
VALUES (...,???,...) <-------
END
Greetings,
Filip Moons
- How can i check if an update is succeeded? I have to update a
single row, if the row doesn't exist i have to raise an exception. I
tried checking SQLCCODE after the updates 'WHEN SQLCODE 100' but that
didn't workout. Or do i have to do 'IF (EXISTS (SELECT 1 FROM ...
WHERE ...) prior to doing the update?
- How can i get hold of the changed exception messagetext in a 'WHEN
EXCEPTION' block for logging purposes.
BEGIN
...
...
if ... then
EXCEPTION BAD_ENTRY 'Not good'; <-------
...
...
if ... then
EXCEPTION BAD_ENTRY 'Better but still not right'; <-------
...
...
END
WHEN EXCEPTION BAD_ENTRY DO
BEGIN
/* 'Not good' or 'Better but still not right' */
INSERT LOG (...,MessageText,...)
VALUES (...,???,...) <-------
END
Greetings,
Filip Moons