Hi,
Is the nextval being fetched from the sequence even in the event of an error?
DECLARE
v_description VARCHAR2(45);
BEGIN ...
SELECT description FROM table1
WHERE description = v_description
IF v_description <> 'Some value' THEN
raise_application_error(-20001, 'Value not found!');
ELSE
INSERT INTO table2 (
id,
description
) VALUES (
new_id_seq.NEXTVAL,
v_description
);
END IF;
...
EXCEPTION
WHEN OTHERS THEN
log_error();
END;
/
BTW: Code tags? {code}