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
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
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;
在ORACLE用select ..into ..来替换
学习一下
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;