//goal is to not do any of the logic in the trigger below when flag is null
CREATE OR REPLACE TRIGGER "DBUSER"."TI_USERS"
AFTER INSERT
on Users
for each row
declare numrows INTEGER;
begin
select count(*) into numrows
from Customer
where
/* %JoinFKPK(:%New,Customer," = "," and") */
:new.Customer_Key = Customer.Customer_Key;
if (
/* %NotnullFK(:%New," is not null and") */
numrows = 0
)
then
raise_application_error(
-20002,
'Cannot INSERT Users because Customer does not exist.'
);
end if;
end;
ALTER TRIGGER "SIMPLEX"."TI_USERS" ENABLE