问题描述
我在oracle中有一个存储过程,想从SQLPlus中对其进行测试.
I have a stored procedure in oracle and want to test it from SQLPlus.
如果我使用
execute my_stored_proc (-1,2,0.01)
我收到此错误
PLS-00306: wrong number or types of arguments in call to my_stored_proc
proc的开始是这样
The beginning for the proc is this
create or replace PROCEDURE my_stored_proc
( a IN NUMBER,
b IN NUMBER,
c IN NUMBER,
z out NUMBER
) AS ....
我需要为out参数提供一个var吗,怎么办?我试过了:
Do I need to provide the a var for the out parameter, is so how? I tried:
var z NUMBER;
但是当我尝试运行proc时出现此错误
But get this error when I try to run the proc
execute my_stored_proc (-1,2,0.01,z)
PLS-00201: identifier 'Z' must be declared
另外,当我在SQL-Developer中时,它给了我用法,并以相反的顺序显示了输入,即:
Also when I was in SQL-Developer it gave me the usage and it show the inputs in reverse order, that is:
execute my_stored_proc(z number,c number,b number,a number);
您以相反的顺序提供它们,还是SQL-Developer提供了这些功能
Do you provide them in reverse order or is that just something with SQL-Developer
我没有编写程序,通常也不会处理它们,所以我可能会遗漏一些明显的东西.
I did not write the procedure and I don't normally deal with them so I could be missing something obvious.
谢谢
推荐答案
您有两个选择,一个PL/SQL块或SQL * Plus绑定变量:
You have two options, a PL/SQL block or SQL*Plus bind variables:
var z number
execute my_stored_proc (-1,2,0.01,:z)
print z
这篇关于如何从SQL Plus执行存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!