如何从命令行调用 Oracle SQL 过程?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9466258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 14:33:44  来源:igfitidea点击:

How do I call an Oracle SQL procedure from the command line?

sqloraclestored-procedurescommand-line

提问by Anandhakrishnan

How do I call an Oracle stored procedure with parameters?

如何使用参数调用 Oracle 存储过程?

It has one input and one output parameter, and looks like doSomething(IN x,OUT y);.

它有一个输入和一个输出参数,看起来像doSomething(IN x,OUT y);.

How do I call it from the command line?

如何从命令行调用它?

回答by a_horse_with_no_name

Assuming SQL*Plus:

假设 SQL*Plus:

var v_result number
exec doSomething(42, :v_result);
print v_result

You can put that into a SQL script and pass that on the commandline to SQL*Plus.

您可以将其放入 SQL 脚本中,然后通过命令行将其传递给 SQL*Plus。

回答by SNAG

try this

尝试这个

BEGIN
var v_outparam1 number;
var v_outparam2 number;
exec myProc(v_outparam1,v_outparam1);
END;
/