首页新闻找找看学习计划

oracle 触发器

0
[待解决问题]

CREATE OR REPLACE TRIGGER "T_GINDEX_ID_TRIG" BEFORE INSERT OR UPDATE ON "T_GINDEX" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW DECLARE

v_newVal NUMBER(12) := 0;

v_incval NUMBER(12) := 0;

BEGIN
IF INSERTING AND :new.ID IS NULL THEN

SELECT t_gindex_ID_1SEQ.NEXTVAL INTO v_newVal FROM DUAL;
IF v_newVal = 1 THEN
SELECT NVL(max(ID),0) INTO v_newVal FROM t_gindex;
v_newVal := v_newVal + 1;
LOOP
EXIT WHEN v_incval>=v_newVal;
SELECT t_gindex_ID_1SEQ.nextval INTO v_incval FROM dual; END LOOP;

 

一直报错:[Err] ORA-24344: success with compilation error

小余哥的主页 小余哥 | 菜鸟二级 | 园豆:202
提问于:2018-01-28 17:19
< >
分享
所有回答(1)
0

参考:http://bbs.csdn.net/topics/390828604

金琥 | 园豆:2540 (老鸟四级) | 2018-01-29 10:46
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册