Home > Net >  PL/SQL FUNCTION ERROR PLS-00103: Encountered the symbol "DOUBLE" when expecting one of the
PL/SQL FUNCTION ERROR PLS-00103: Encountered the symbol "DOUBLE" when expecting one of the

Time:12-25

I'm trying to to create this simple PL/SQL function that takes from the user a price value and apply a discount on it to return the price after the discount. but I keep getting this error

PLS-00103: Encountered the symbol "DOUBLE" when expecting one of the following: (

Here is my code:

CREATE OR REPLACE FUNCTION CalculateDiscount (PRICE IN DOUBLE)
RETURN DOUBLE
IS
TOTAL DOUBLE;
BEGIN
SELECT DISCOUNT_ALLOWED FROM EMPLOYEE WHERE EMP_ID = :APP_USER;
EXCEPTION WHEN NO_DATA_FOUND THEN TOTAL := 0;
TOTAL:=PRICE * DISCOUNT_ALLOWED;
TOTAL:=PRICE - TOTAL;
RETURN TOTAL;
END;

CodePudding user response:

You intended to use DOUBLE PRECISION, there is no DOUBLE type in Oracle. You could also use NUMBER. See more here: https://docs.oracle.com/cd/A58617_01/server.804/a58241/ch5.htm#427628

  • Related