我在sql*Plus中创建表和相应的触发器,但总是有错误:创建的触发器带有编译错误。 请看下面代码:
我在sql*Plus中创建表和相应的触发器,但总是有错误:创建的触发器带有编译错误。 请看下面代码:
create table `Emp(old.sal number(10) not null,new.sal number(10) not null,sal_diff number(10) not null) tablespace system
创建表成功后,下面创建触发器
create or replace trigger print_salary_changes
before delete or insert or update on Emp
for each row
declare
sal_diff:=:new.sal-:old.sal;
dbms_output.put('old salary:'||:old.sal);
dbms_output.put('new salary:'||:new.sal);
dbms_output.put_line('DIFFERENCE'||sal_diff);
end;
/
"创建的触发器带有编译错误" 原因在哪呀?多谢!
问题点数:0、回复次数:2Top
1 楼lgyqd()回复于 2005-04-02 16:21:02 得分 0
帮忙看一下吧!Top
2 楼w7a8(阿飞)回复于 2005-04-04 15:54:45 得分 0
create or replace trigger print_salary_changes
before delete or insert or update on Emp
for each row
declare
sal_diff varchar2(20);
begin
sal_diff:=:new.sal-:old.sal;
dbms_output.put('old salary:'||:old.sal);
dbms_output.put('new salary:'||:new.sal);
dbms_output.put_line('DIFFERENCE'||sal_diff);
end;
/Top




