gpt4 book ai didi

oracle - 如何从Oracle存储过程获取两个返回值

转载 作者:行者123 更新时间:2023-12-04 09:11:56 28 4
gpt4 key购买 nike

我知道如何从Oracle的Oracle SP中获得值,返回值,如下所示

MyReturn := MY_ORACLE_SP ();

如果MY_ORACLE_SP2的返回值为 多于一个。我能怎么做?

最佳答案

-- 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 - 如何从Oracle存储过程获取两个返回值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9484135/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com