I have the following pl/sql for a save button on an orders form: i am trying to check the amount entered for the order against the quantity in stock in the item table. then update the amount in the item table accordingly and commit the form, otherwise display an error.
im getting an error:raise application error must be declared.
Declare
V_orderqty orders.order_qty %TYPE;
Begin
Select ITEM.QTY_IN_STOCK into v_orderqty
From ITEM
Where ITEM.ITEM_ID=:orders.ITEM_NO;
If :orders.ORDER_QTY<=v_orderqty
Then Update item i
Set i.QTY_IN_STOCK=(i.QTY_IN_STOCK - :orders.ORDER_QTY)
Where i.ITEM_ID=:orders.ITEM_NO;
Commit ;
Else
Raise_application_error(-20201,'Not enough items in stock');
End IF;
End;
Also how do you enter values in field on a form using pl/sql example:
Declare
V_items item%ROWTYPE;
Begin
Select * into V_item
From ITEM
Where itemno=:orders.ITEM_NO;
/*Populate the item fields with this row of values*/
End;
-----------------------------------------------------------------
Find the home of your dreams with eircom net property
Sign up for email alerts now http://www.eircom.net/propertyalerts
Oracle LazyDBA home page