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;
CREATE OR REPLACE TRIGGER tony."tri_users_info" BEFORE INSERT ON tony.emp REFERENCING OLD AS "OLD" NEW AS "NEW"
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;
------其他解决方案-------------------- 在BEGIN前面加上一行
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;
/
CREATE OR REPLACE TRIGGER gw."tri_users_info" BEFORE INSERT ON gw.users_info REFERENCING OLD AS "OLD" NEW AS "NEW"
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;