Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> immdiate help now please please please
i am doing my homeworks but i got compilation errors so why? would you
please fix for me? thanks in advance.
3. Write a function that will calculate the tax on an order. The tax
per item depends on the individual product cost. Items costing $1000 or
more are taxed at 8% while items costing $999.99 or less are taxed at
6%. (This is the price per item, not the extended price.)
· Calculate the tax for the entire order (25 points)
· Not Calculate the tax for a single product (15 points)
SQL> CREATE OR REPLACE FUNCTION F_TAX (p_invoice_number IN
2 ORDER_DETAIL.INVOICE_NUMBER%TYPE) RETURN NUMBER IS
3 CURSOR c_order_detail (p_invoice_number
ORDER_DETAIL.INVOICE_NUMBER%TYPE)
4 IS
5 SELECT * 6 FROM ORDER_DETAIL 7 WHERE invoice_number = p_invoice_number 8 ; 9 total ORDERS.TAX%TYPE; 10 BEGIN 11 total := 0; 12 FOR r_order_detail IN c_order_detail (p_invoice_number) LOOP 13 IF (r_order_detail.UNIT_PRICE > 1000) THEN 14 total := total + ((r_order_detail.UNIT_PRICE * 0.08) * 15 r_order_detail.QUANTITY); 16 ELSE 17 total := total + ((r_order_detail.UNIT_PRICE * 0.06) * 18 r_order_detail.QUANTITY); 19 END IF; 20 END LOOP; 21 RETURN total; 22 EXCEPTION 23 WHEN OTHERS THEN 24 RAISE_APPLICATION_ERROR (-20203, 'Unhandledexception: ' ||
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION F_TAX:
LINE/COL ERROR
0/0 PL/SQL: Compilation unit analysis terminated 2/1 PLS-00201: identifier 'AB_TEST.AORDER_DETAIL' must be declaredSQL>
-- Posted via Mailgate.ORG Server - http://www.Mailgate.ORGReceived on Wed Feb 20 2002 - 02:30:41 CST