表user_info的字段Userid(number类型)设置为自增字段,相应的序列已经建成,但是建触发器报错:CREATE OR REPLACE TRIGGER "gw"."tri_users_info" BEFORE INSERT ON "gw"."users_info" REFERENCING OLD AS "OLD" NEW AS "NEW"
BEGIN
IF :new.Userid is null or :new.Userid=0 then
select users_info_seq.NEXTVAL
into :new.Userid
FROM sys.DUAL;
end if;
END;保存报错:ORA-24344 success with compilation error.请教各位前辈大侠。
BEGIN
IF :new.Userid is null or :new.Userid=0 then
select users_info_seq.NEXTVAL
into :new.Userid
FROM sys.DUAL;
end if;
END;保存报错:ORA-24344 success with compilation error.请教各位前辈大侠。
for each row
create or replace trigger gw.tri_users_info
before insert
on gw.user_info
--REFERENCING OLD AS "OLD" NEW AS "NEW"
for each row
begin
if :new.Userid is null or :new.Userid=0 then
:new.Userid := user_info_seq.nextval;
end if;
end;
/
for each row
BEGIN
IF :new.Userid is null or :new.Userid=0 then
select users_info_seq.NEXTVAL
into :new.Userid
FROM sys.DUAL;
end if;
END;
for each row
BEGIN
IF :new.empno is null or :new.empno=0 then
select users_info_seq.NEXTVAL
into :new.empno
FROM sys.DUAL;
end if;
END;我试下来是没问题的.你检查下你的用户名,表格名和列名,sequence名有没有拼写错误。还有,把具体错误发上来,
sqlplus执行的话,show error
sql developer的话,右键菜单 [编译],执行后右下的窗口里面就有具体错误信息。