CREATE OR REPLACE FUNCTION ComputeFreight(subtotal NUMBER)
RETURN NUMBER
IS
freightCharge NUMBER;
BEGIN
IF subtotal <= 15000 THEN
freightCharge := (subtotal * .10);
ELSIF subtotal > 15000 THEN
freightCharge := (subtotal * .15);
RETURN(freightCharge);
END IF;
END;
DECLARE
subtotal NUMBER := 15000;
BEGIN
DBMS_OUTPUT.PUT_LINE( ComputeFreight(subtotal) );
END;
I don't know whats wrong with my code but it always shows this error:
Invalid statement
Invalid statement
ORA-06503: PL/SQL: Function returned without value ORA-06512: at "SQL_JQQXUMCMKFMRHRPZCYFNBEVTN.COMPUTEFREIGHT", line 12 ORA-06512: at line 4 ORA-06512: at "SYS.DBMS_SQL", line 1721