set @num=( select count(*) from wang_road 
           where  (crossingid=:old.crossingid) and (lanename=:old.LaneName));
改成
 select count(*) into num from wang_road 
           where  (crossingid=:old.crossingid) and (lanename=:old.LaneName)if @num>0 
改成
if num>0 then

解决方案 »

  1.   

    CREATE OR REPLACE TRIGGER "ITS"."LANECONFIGDELETE" 
    AFTER DELETE ON "ITS"."LANECONFIG" 
        FOR EACH ROW begin
    declare 
    num number;
    begin
         select count(*) into num from wang_road 
         where (crossingid=:old.crossingid) 
         and (lanename=:old.LaneName));
         if num>0  then 
            delete from wang_road  
            where  (crossingid=:old.crossingid) 
            and    (lanename=:old.LaneName);
         end if;
    end;
      

  2.   

    set @num = 是SQL SERVER中的写法.
    在ORACLE用select ..into ..来替换
      

  3.   

    SQLSERVER不懂的说,
    学习一下
      

  4.   

    不好意思多了一個括號
    CREATE OR REPLACE TRIGGER "ITS"."LANECONFIGDELETE" 
    AFTER DELETE ON "ITS"."LANECONFIG" 
        FOR EACH ROW begin
    declare 
    num number;
    begin
         select count(*) into num from wang_road 
         where (crossingid=:old.crossingid) 
         and (lanename=:old.LaneName); --這兒
         if num>0  then 
            delete from wang_road  
            where  (crossingid=:old.crossingid) 
            and    (lanename=:old.LaneName);
         end if;
    end;
      

  5.   

    你原来的不是oracle的语法,oracle跟sql的区别很大,baojianjun(包子)的应该没问题