Jay Jarman
Jay Jarman

Reputation: 29

Oracle 11g Create Function Fails

I'm trying to create a simple function in oracle for my lesson plan and cannot see what I'm doing wrong.

CREATE OR REPLACE FUNCTION ten_pct(num1 IN NUMBER) 
RETURN NUMBER
IS
BEGIN
RETURN (num1 * 0.1);
END;

I've tried declaring a variable and setting it equal to the equation and returning it and get the same error.

Error(2,14): PLS-00103: Encountered the symbol "" when expecting one of the following: . @ % ; is authid as cluster order using external character deterministic parallel_enable pipelined aggregate result_cache The symbol "" was ignored.

I'm hoping someone sees my mistake.

Upvotes: 0

Views: 614

Answers (1)

Justin Cave
Justin Cave

Reputation: 231681

That code works on my machine

SQL> CREATE OR REPLACE FUNCTION ten_pct(num1 IN NUMBER)
  2  RETURN NUMBER
  3  IS
  4  BEGIN
  5  RETURN (num1 * 0.1);
  6  END;
  7  /

Function created.

Realistically, there is some difference between the code that you posted here and the code that you're actually trying to run.

Upvotes: 2

Related Questions