plsql - Exception handler not raising -
** Updated errors have been fixed, but it still does not work as I want. I need to create a user defined exception handler which does not allow zero values to be included as the cost of the item, but missing_cost is not running due to some reason. I have set user_id and item_cost to define the user but I think it is not passing correctly?
The tables are:
pitem {item_id number; Item_name character (20); Item_desc char (20); Retail_price number (10, 2); Item_code number (10,2); Category four (10); } and ...
pitem_audit {item_id number; Message four (80); } Thanks in advance!
In the form of update_item_cost (iItemId INTEGER, fNewcost NUMBER) create or change fCurCost NUMBER (10,2); Missing_cost EXCEPTION; Item_id pitem.item_id% Type: = & amp; item_id; Item_cost pitem.item_cost% Type: = & amp; item_cost; Select item_cost in fCurCost with pitem where item_id = iItemid; If fCurCost is null then increase the wrong_coast; Else updated pitem item_cost = fNewCost where item_id = iItemid; end if; Committed; End; Exception when no_data_found is then inserted into pitem_audit values (iItemid, 'invalid item identifier.'); Committed; When missing_kost then enter the pitem_audit values (iItemid, 'item value is zero.'); Committed; When others rollback; Enter the Pitem_audit values (iItemid, 'Miscellaneous Error.'); Committed; End update_item_cost; This is the structure of a process:
process & lt; procname & gt; (& Lt; Parameters & gt;) & lt; declarations & gt; To get started & lt; To execute the body & gt; Exception & lt; Exception Managers & gt; End & lt; procname & gt ;; In your case, you have an additional end; : process & lt; procname & gt; (& Lt; Parameters & gt;) & lt; declarations & gt; To get started & lt; To execute the body & gt; End; & Lt; - This is the wrong exception & lt; Exception Managers & gt; End & lt; procname & gt ;;
Comments
Post a Comment