Posted on 2004-08-26
I'm writing my first PL/SQL Procedure....
I want to cycle through a cursor and if the value in a field is $10.00 or less I want to insert the associated account number into a table.
I wrote the code just fine, and it works as it should unless there is a unique constraint error on the Insert...
If that occurs, I simply want to ignore the error and continue with the remaining records in the cursor, but I can not figure out how.
Here is my code so far:
CREATE OR REPLACE PROCEDURE MORGAN_TEST IS
cursor TESTING is select ban, refund_amount from refund where REFUND_STATUS = 'WQ';
for rec in TESTING loop
if (rec.refund_amount < 10.01) then
execute immediate 'insert into REFUND_TOO_SMALL (BAN) VALUES (:1 )'
WHEN UNIQUE_CONSTRAINT THEN
-- I have no idea what to do here to ignore the unique constraint error