The Trigger Solution
RAISE_APPLICATION_ERROR(RANGE,ERROR_MESSAGE);
This is an Oracle defined procedure that allows a user to issue user defined error-messages
Range is a number from -20000 to -20999
So the trigger effectively changes to:
create or replace trigger trig_item_chkbal
after update on item_master for each row
declare
begin
if (:new.i_bal_stock <> delete from item_request where r_code = 2;
delete from item_request where r_code = 2
*
ERROR at line 1:
ORA-20001: No negative balance stock
ORA-06512: at "SYSTEM.TRIG_ITEM_CHKBAL", line 5
ORA-04088: error during execution of trigger 'SYSTEM.TRIG_ITEM_CHKBAL'
ORA-06512: at "SYSTEM.TRIG_ITEM", line 2
ORA-04088: error during execution of trigger 'SYSTEM.TRIG_ITEM'
"Harder than steel ... Too hard to break. This heart of steel."
0 Responses to The Trigger Solution
Something to say?