如何从Oracle存储过程获取两个返回值 [英] How to get two return value from Oracle Stored Procedure
本文介绍了如何从Oracle存储过程获取两个返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何从Oracle的Oracle SP中获得一个回报值,如下所述
I know how to get one return value from Oracle SP in Oracle as follow
MyReturn := MY_ORACLE_SP ();
如果MY_ORACLE_SP2的返回值不止一个.我该怎么办?
If MY_ORACLE_SP2's return value is more than one. How can I do?
推荐答案
-- IN arguments : you get them. You can modify them locally but caller won't see it
-- IN OUT arguments: initialized by caller, already have a value, you can modify them and the caller will see it
-- OUT arguments: they're reinitialized by the procedure, the caller will see the final value.
CREATE PROCEDURE f (p IN NUMBER, x IN OUT NUMBER, y OUT NUMBER)
IS
BEGIN
x:=x * p;
y:=4 * p;
END;
/
SET SERVEROUTPUT ON
declare
foo number := 30;
bar number := 0;
begin
f(5,foo,bar);
dbms_output.put_line(foo || ' ' || bar);
end;
/
输出:150 20
这篇关于如何从Oracle存储过程获取两个返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文