执行触发时遇到以下错误:
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;
请提出可能导致问题的原因。
修改
数据类型:
trig_pkg.rowIndex - Number
trig_pkg.rimage_id - IS TABLE OF INTEGER INDEX BY binary_integer;
trig_pkg.hold_imid_tablsize- NUMBER(14)
答案 0 :(得分:3)
尝试删除以下IF部分字符串
IF (trig_pkg.rimage_id IS NOT NULL) THEN
INDEX BY
- 表格不需要初始化