学习创建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;
/
- 将@a替换为a
- 将替换为中的
- 从退货中删除s
- 若要避免出现警告,请在为之前添加AUTHID DEFINER
- 为了可读性,请在结束之后添加testf
- 如果是脚本的一部分,请在end下方的行添加/