Exception Handling
Posted in 1998
Hi.....Users.
In one of my procedures i am trying to trap the
error -268 (duplicate value) & i want to resume after the exception.
The code is
Procedure ...............
DEFINE dttm DATETIME YEAR TO FRACTION(5);
DEFINE fract DATETIME SECOND TO FRACTION(5);
LET dttm = EXPAND (CURRENT, YEAR TO
FRACTION(5));
LET fract = 00.00001;
WHILE(flag='T')
BEGIN
ON EXCEPTION IN (-268)
LET fract =
fract + 00.00001;
LEt dttm =
dttm + fract;
END EXCEPTION WITH
RESUME;
END;
INSERT INTO table_abc
values (abc, xyz, dttm); END;
END;
END PROCEDURE;
This procedure is called by a trigger which is on a
different table. The problem here is that if many users are doing the
transactions this procedure comes out with an error. The field dttm is
a unique key. So, if the record already exists i just increment it by
the value fract.
What is the way to handle the exception & let the
program continue till it inserts a unique value.
Regards,
Praveen
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com