Learning to create oracle user defined function and here is the code:
create or replace function testf(@a as int)
returns int is
begin
return
(@a 5)
end;
Why is this not working for me? Error: Error(1,16): PLS-00103: Encountered the symbol "@" when expecting one of the following: current delete exists prior
CodePudding user response:
If you use Oracle, then follow its syntax.
SQL> create or replace function testf (par_a in int)
2 return int
3 is
4 begin
5 return par_a 5;
6 end;
7 /
Function created.
SQL> select testf(100) result from dual;
RESULT
----------
105
SQL>
CodePudding user response:
create or replace function testf(a in int)
return int authid definer is
begin
return (a 5)
end testf;
/
- Replace @a with a.
- Replace as with in
- Remove s from returns.
- To avoid a warning, add AUTHID DEFINER just before is.
- For readability, add testf after end.
- If part of a script, add a / on the line below end;