I want to create a function that return the power of a given number, the SQL developer keep giving me this error :
PLS-00103: Encountered the symbol "BEGIN"
Errors: check compiler log
Here's my code
CREATE OR REPLACE FUNCTION Power(x NUMBER,n NUMBER) return Number IS
Pow number;
i number;
BEGIN
Pow:=1;
FOR i IN 1..n LOOP
Pow:=Pow*x;
END LOOP;
return Pow;
END Power;
BEGIN
DBMS_OUTPUT.PUT_LINE(Power(2,3));
END;
Thank you for helping me I really appreciate it.