create or replace trigger trig_aaa
before insert on aaa
for each row
declare 
salaryerror exception;
count1 number(4);
begin
select count(*) into count1 from bbb where c_name=:new.c_name;
if count1=0 then
insert into ccc(c_name)values(:new.c_name);
else
raise salaryerror;
endif;
exception
when salaryerror then
dbms_output.put_line('werwerwe');
end;

解决方案 »

  1.   

    show error 看看是什么错误。
      

  2.   

    我把IF COUNT1〈 O THEN 改为if count1=0 then还是不对呀
      

  3.   

    13行Endif;改为End If;
    也就是加个空格
    你可以使用PL/SQL Developer来编译,很方便提示错误行,和错误类型
    我在我的机器上调试通过!
      

  4.   

    行号= 10 列号= 1 错误文本= PLS-00103: 出现符号 "WHEN"在需要下列之一时:  begin case declare end    exception exit for goto if loop mod null pragma raise return    select update while with <an identifier>    <a double-quoted delimited-identifier> <a bind variable> <<    close current delete fetch lock insert open rollback    savepoint set sql execute commit forall merge    <a single-quoted SQL string> pipe 符号 "case" 被替换为 "WHEN" 后继续。 
    行号= 12 列号= 4 错误文本= PLS-00103: 出现符号 ";"在需要下列之一时:  case 
    以上是错误提示呀,我把ENDIF 改为END IF ,还是不可以呀
      

  5.   

    出现如下错误呀 行号= 18 列号= 1 错误文本= PLS-00103: 出现符号 "DBMS_OUTPUT"在需要下列之一时:  := . ( @ % ; 符号 ":=" 被替换为 "DBMS_OUTPUT" 后继续。 
      

  6.   

    sorry,endif  ===>end if
      

  7.   

    老兄!set serveroutput on
    再看看