rem This trigger fires on an insert into the HOLDING table rem It checks that there is sufficient cash for the purchase create or replace trigger check_cash after insert on holding for each row declare tempcash number(8,2); begin select cash into tempcash from portfolio where portfoliono = :new.portfoliono; if :new.numbershares * :new.purchaseprice > tempcash then raise_application_error(-20001,'Insufficient cash in portfolio'); end if; end; /