1.不带参数的
create or replace function getUser return varchar2 is
test varchar2(20);
begin
test := '123';
return test;
end;
执行: select getUser from dual;
2.带in参数的
create or replace function test(par in varchar2) return varchar2 is
v varchar2(20);
begin
v := par;
return v;
end;
执行: select test(‘hello’) from dual
本文介绍了在PL/SQL中如何创建并使用不带参数及带参数的函数。通过两个示例,详细展示了函数定义的方法及如何在SQL查询中调用这些函数。
1455

被折叠的 条评论
为什么被折叠?



