I am experiencing below error on execution of trigger:
SQL Error: ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "Test.ADD_DUMMY_RULE", line 13
create or replace
TRIGGER "ADD_DUMMY_RULE"
BEFORE DELETE ON testTable
FOR EACH ROW
WHEN (
old.product_id != 0
)
DECLARE
pcnt NUMBER(14);
BEGIN
pcnt := 0;
trig_pkg.rowIndex := trig_pkg.rowIndex + 1;
-- STORING IMAGE_ID
trig_pkg.old_image_id := :OLD.image_id;
IF (trig_pkg.rimage_id IS NOT NULL) THEN
FOR i IN 1..(trig_pkg.hold_imid_tablsize) LOOP
IF (trig_pkg.old_image_id = trig_pkg.rimage_id(i)) THEN
pcnt := pcnt + 1;
END IF;
END LOOP;
END IF;
END;
Please suggest what could be the cause of issue.
Edit
datatypes:
trig_pkg.rowIndex - Number
trig_pkg.rimage_id - IS TABLE OF INTEGER INDEX BY binary_integer;
trig_pkg.hold_imid_tablsize- NUMBER(14)
trig_pkg.hold_imid_tablsize
? More importantly, do you have more than one trigger - the code is forADD_DUMMY_RULE_
, the error is forADD_DUMMY_RULE
(without the trailing underscore) - is that something you've introduced in the question, or is that what you're really seeing? - Alex Pooletrig_pkg.hold_imid_tablsize
always have a value or can it benull
at some point? (Not sure if 1..null would cause ORA-06502 though?) - Colin 't Hart