Subject | Catching exception fails under isql |
---|---|
Author | Rick Debay |
Post date | 2013-03-08T15:11:13Z |
Does anyone have any insight in to this?
Running this statement in isql:
EXECUTE PROCEDURE P_IMPORT;
Yields this error:
Statement failed, SQLCODE = -508
no current record for fetch operation
-violation of PRIMARY or UNIQUE KEY constraint
Yet running the same statement in Database Workbench yields no error.
The procedure is written to ignore unique_key_violation:
FOR SELECT
COL1, COL2 , ...
FROM
P_SELECT
INTO
:COL1, :COL2, ...
DO BEGIN
INSERT INTO
THE_TABLE (
COL1, COL2, ...
)
VALUES (
:COL1, :COL2, ...
);
WHEN GDSCODE unique_key_violation DO COL_1=NULL;
END
Running this statement in isql:
EXECUTE PROCEDURE P_IMPORT;
Yields this error:
Statement failed, SQLCODE = -508
no current record for fetch operation
-violation of PRIMARY or UNIQUE KEY constraint
Yet running the same statement in Database Workbench yields no error.
The procedure is written to ignore unique_key_violation:
FOR SELECT
COL1, COL2 , ...
FROM
P_SELECT
INTO
:COL1, :COL2, ...
DO BEGIN
INSERT INTO
THE_TABLE (
COL1, COL2, ...
)
VALUES (
:COL1, :COL2, ...
);
WHEN GDSCODE unique_key_violation DO COL_1=NULL;
END