When we execute queries, due to some errors , some exceptions may occur. How do we handle these ?
In Oracle it by using Exception Clause.
CREATE OR REPLACE TRIGGER TBD_CA_CALL
BEFORE DELETE ON CALL FOR EACH ROW
if (:old.sts_code != 'CLOSED')
if (:old.trx_sts = 'A')
delete cmmn_note_hdr where
obj_type = ('CALLMDFN') and
obj_code = :old.call_no ;
delete ntfy_history where
object_info = :old.call_no ;
delete cmmn_mod_history where
table_name = 'call' and key_val = :old.call_no ;
WHEN illegal_delete then raise_application_error(-20011,
'Active Call cannot be deleted ');