avoid hard coding
296586Sep 3 2007 — edited Sep 3 2007I am looking at an example in my oracle press PL/SQL book. The example is as follows:
DECLARE
V_DISCOUNT NUMBER(3,2);
V_PRICE NUMBER(3);
PROCEDURE GET_DISCOUNTED_PRICE(P_PRICE NUMBER) IS
BEGIN
V_PRICE := (P_PRICE * V_DISCOUNT);
END;
BEGIN
V_PRICE := 249.99;
V_DISCOUNT :=.10;
GET_DISCOUNTED_PRICE(V_PRICE);
DBMS_OUTPUT.PUT_LINE('THE DISCOUNTED PRICE IS '||V_PRICE);
END;
How can I get the results without hard coding V_PRICE:=249.99 or v_discount:=10. I know to use bind variables but would it be to add another procedure that select the values from the table for v_price and passing the v_discount in as a parameter?