Oracle 函数错误 (1,16): PLS-00103: 遇到符号"@"



学习创建oracle用户定义函数,下面是代码:

create or replace function testf(@a as int)
returns int is
begin
return
(@a+5)
end;

为什么这对我不起作用?错误:错误(1,16(:PLS-00103:遇到符号"@"当预期以下情况之一时:当前删除存在于之前

如果使用Oracle,请遵循其语法。

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>
create or replace function testf(a in int)
return int authid definer is
begin
return (a+5)
end testf;
/
  1. @a替换为a
  2. 替换为中的
  3. 从退货中删除s
  4. 若要避免出现警告,请在之前添加AUTHID DEFINER
  5. 为了可读性,请在结束之后添加testf
  6. 如果是脚本的一部分,请在end下方的行添加/

最新更新