Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> immdiate help now please please please

immdiate help now please please please

From: Beau Leo <beauseo_at_netzero.net>
Date: Wed, 20 Feb 2002 08:30:41 +0000 (UTC)
Message-ID: <2c0472948ced9d9409150667075623b9.61814@mygate.mailgate.org>


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, 'Unhandled
exception: ' ||
 25 SUBSTR (SQLERRM, 1, 200));
 26 END F_TAX;
 27 /

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 declared
SQL>
-- 
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Received on Wed Feb 20 2002 - 02:30:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US