我试图运行一个存储过程有多个输入和输出参数。该过程只能通过导航其他用户|在我的“连接”面板中查看|包| |
如果我右键单击,菜单项是“订单成员By …”和“创建单元测试”(灰色)。 “运行”过程的能力似乎不可能,当用户访问时。
我一直在试图找到一个例子,如何创建一个匿名块,使我可以作为一个sql文件运行过程,但没有找到任何有效的。
有谁知道如何从sql Developer中执行此过程?我使用的版本2.1.1.64。
提前致谢!
编辑1:
我想打电话的程序有这个签名:
user.package.procedure( p_1 IN NUMBER,p_2 IN NUMBER,p_3 OUT VARCHAR2,p_4 OUT VARCHAR2,p_5 OUT VARCHAR2,p_6 OUT NUMBER)
如果我写我的匿名块像这样:
DECLARE out1 VARCHAR2(100); out2 VARCHAR2(100); out3 VARCHAR2(100); out4 NUMBER(100); BEGIN EXECUTE user.package.procedure (33,89,:out1,:out2,:out3,:out4); END;
我得到的错误:
Bind Varialbe "out1" is NOT DECLCARED anonymous block completed
我试过初始化out *变量:
out1 VARCHAR2(100) := '';
但得到相同的错误:
编辑2:
基于亚历克斯的答案,我试图从参数前面删除冒号,得到这个:
Error starting at line 1 in command: DECLARE out1 VARCHAR2(100); out2 VARCHAR2(100); out3 VARCHAR2(100); out4 NUMBER(100); BEGIN EXECUTE user.package.procedure (33,out1,out2,out3,out4); END; Error report: ORA-06550: line 13,column 17: PLS-00103: Encountered the symbol "USER" when expecting one of the following: := . ( @ % ; immediate The symbol ":=" was substituted for "USER" to continue. 06550. 00000 - "line %s,column %s:\n%s" *Cause: Usually a PL/sql compilation error. *Action:
使用简单的参数类型(即不是refcursors等),你可以这样做:
原文链接:https://www.f2er.com/oracle/208301.htmlSET serveroutput on; DECLARE InParam1 number; InParam2 number; OutParam1 varchar2(100); OutParam2 varchar2(100); OutParam3 varchar2(100); OutParam4 number; BEGIN /* Assign values to IN parameters */ InParam1 := 33; InParam2 := 89; /* Call procedure within package,identifying schema if necessary */ schema.package.procedure(InParam1,InParam2,OutParam1,OutParam2,OutParam3,OutParam4); /* Display OUT parameters */ dbms_output.put_line('OutParam1: ' || OutParam1); dbms_output.put_line('OutParam2: ' || OutParam2); dbms_output.put_line('OutParam3: ' || OutParam3); dbms_output.put_line('OutParam4: ' || OutParam4); END; /
编辑使用OP的规范,并与另一种方法利用:var绑定变量:
var InParam1 number; var InParam2 number; var OutParam1 varchar2(100); var OutParam2 varchar2(100); var OutParam3 varchar2(100); var OutParam4 number; BEGIN /* Assign values to IN parameters */ :InParam1 := 33; :InParam2 := 89; /* Call procedure within package,identifying schema if necessary */ schema.package.procedure(:InParam1,:InParam2,:OutParam1,:OutParam2,:OutParam3,:OutParam4); END; / -- Display OUT parameters print :OutParam1; print :OutParam2; print :OutParam3; print :OutParam4;