Für Interbase 6 kommt so'n Mischmasch aus Trigger und Stored procedure heraus:
SQL-Code:
set term /;
create trigger ti_rvv
for tabelle1
before
insert as
declare variable numrows
integer;
begin
/* Parent "tabelle2" must exist when inserting a child in "tabelle1" */
if (new.spalte
is not null)
then
begin
select count(*)
from tabelle2
where tabelle2.spalte= new.spalte
into :numrows;
if (numrows = 0)
then
begin
exception sdp_icpe;
end
end
...
end
end;/
set term ;/