--创建表:
Create table scott.test
(
ID int,
name varchar2(50)
);--创建触发器:
--在执行insert语句后再插入一条记录
Create or replace trigger scott.test_trigger
after insert
on scott.test
Declare
aa varchar(50):='created by Trigger';
ii int:=0;
Begin select max(ID)
into ii
from scott.test
if(ii = null) then
ii:=0;
end if;
Insert into scott.test
select ii+1,aa
from dual;
DBMS_OUTPUT.PUT_LINE('Trigger ok!');End scott.test_trigger; --插入一条记录:
Insert into scott.test
select '1','Create By Edgar'
from dual;报错信息:
触发器'scott.test_trigger'无效且未通过重新验证请问错在何处?
Create table scott.test
(
ID int,
name varchar2(50)
);--创建触发器:
--在执行insert语句后再插入一条记录
Create or replace trigger scott.test_trigger
after insert
on scott.test
Declare
aa varchar(50):='created by Trigger';
ii int:=0;
Begin select max(ID)
into ii
from scott.test
if(ii = null) then
ii:=0;
end if;
Insert into scott.test
select ii+1,aa
from dual;
DBMS_OUTPUT.PUT_LINE('Trigger ok!');End scott.test_trigger; --插入一条记录:
Insert into scott.test
select '1','Create By Edgar'
from dual;报错信息:
触发器'scott.test_trigger'无效且未通过重新验证请问错在何处?
select ii+1,aa
from scott.test;