各位大侠,请问一下在oracle中function调用带输出参数的存储过程,要如何操作才能实现?
假设我现在存在一个存储过程:
create or replace procedure PRO_GET_NEXTID_BYCONFIG(varTABLENAME in varchar2,varFIELDNAME in varchar2,varNEWID out varchar2) is
...xxx......
...xxx......
end PRO_GET_NEXTID_BYCONFIG;
上面的存储过程经过测试是没有问题的,现在我想要操作的是在一个function中调用这个存储过程,把这个存储过程输出的值在function中输出,在function中要如何操作?
------解决思路----------------------
--创建过程
create or replace procedure pro2
(a in int :=0,b in int :=0,c out int)
is
c int :=0;
begin
c:=a+b;
end;
--创建函数,调用上面的存储过过程,接受存储过程的返回值
CREATE OR REPLACE FUNCTION fun_test RETURN id integer IS
declare a int;
b int;
c int;
BEGIN
begin
a := 100;
b := 200;
pro2(a, b, c);
id := c;
return;
END fun_test;
--测试
select fun_test() from dual
--ps:我也是刚开始写plsql,都是简单的例子,自己也练练手