Home » SQL & PL/SQL » SQL & PL/SQL » Function not working (Oracle 10G, Windows)
Function not working [message #686715] Tue, 29 November 2022 04:53 Go to next message
hissam78
Messages: 186
Registered: August 2011
Location: PAKISTAN
Senior Member
Dear Experts,
Somebody can guide me, why is the error in the given code for Function creation, it shows PLS-00103 error code.

CREATE OR REPLACE FUNCTION f(p_in IN NUMBER) RETURN number
BEGIN
return p_in*2;
END;
/

thanks,


regards,
Re: Function not working [message #686716 is a reply to message #686715] Tue, 29 November 2022 05:43 Go to previous messageGo to next message
Michel Cadot
Messages: 68342
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Just ask SQL*Plus:
SQL> CREATE OR REPLACE FUNCTION f(p_in IN NUMBER) RETURN number
  2  BEGIN
  3  return p_in*2;
  4  END;
  5  /

Warning: Function created with compilation errors.

SQL> sho err
Errors for FUNCTION F:
LINE/COL ERROR
-------- -------------------------------------------------------------------------------------
2/1      PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
         . @ % ; is authid as cluster order using external character
         deterministic parallel_enable pipelined aggregate
         result_cache
         The symbol "is" was substituted for "BEGIN" to continue.
Re: Function not working [message #686717 is a reply to message #686715] Thu, 01 December 2022 02:15 Go to previous messageGo to next message
Michel Cadot
Messages: 68342
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Any feedback?
Did you find the solution?

Re: Function not working [message #686720 is a reply to message #686717] Fri, 02 December 2022 01:02 Go to previous messageGo to next message
hissam78
Messages: 186
Registered: August 2011
Location: PAKISTAN
Senior Member
Thanks For reply Michel Cadot,
Not Yet

regards
Re: Function not working [message #686721 is a reply to message #686720] Fri, 02 December 2022 03:07 Go to previous messageGo to next message
Michel Cadot
Messages: 68342
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Did you read the error message?
What does mean the first line?

Re: Function not working [message #686726 is a reply to message #686720] Sat, 03 December 2022 00:28 Go to previous messageGo to next message
hissam78
Messages: 186
Registered: August 2011
Location: PAKISTAN
Senior Member
Sorry, I do not understand Please.
Re: Function not working [message #686727 is a reply to message #686726] Sat, 03 December 2022 00:37 Go to previous message
Michel Cadot
Messages: 68342
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

What does mean "Encountered the symbol "BEGIN" when expecting one of the following:"?

Alternatively check CREATE FUNCTION syntax and examples in SQL reference.

Previous Topic: Find row count after update
Next Topic: Performance issue with Update statement having select Statement
Goto Forum:
  


Current Time: Mon Jan 30 02:10:12 CST 2023