* EDIT6:*这最终为我工作(来自接受的答案):
var ret1 number
var tran_cnt number
var msg_cnt number
var rc refcursor
exec :tran_cnt := 0
exec :msg_cnt := 123
exec get_account(Vret_val => :ret1, Vtran_count => :tran_cnt, Vmessage_count => :msg_cnt, Vaccount_id => 1, rc1 => :rc)
print :tran_cnt
print :msg_cnt
print :rc
SQL Developer 让这个超级难/不可能?我不在乎该实用程序是否基于命令行;我只是希望能够快速运行并查看它。如果它也能很好地捕获错误,那就太好了。能够逐渐(交互地)登录以及一次指定所有内容(类似于典型的基于 ftp / sftp cmd 的客户端的工作方式)会很好。
我的平台是 Windows Server 2008 + Cygwin。
编辑:也许你会知道如何使用 Python 编写脚本?
编辑 2:在 MSFT SQL 服务器中,我可以简单地输入:
get_user 1;
然后突出显示它并按 F5,我得到:
login name
NULL Somename
打印到输出窗口。Oracle SQL 开发人员对此根本没有帮助。我不确定如何传入 1,我不确定如何查看返回的实际行/记录。
EDIT3:当我键入var rc refcursor;
并选择它并运行它时,我收到此错误(GUI):
An error was encountered performing the requested operation:
ORA-00900: invalid SQL statement
00900.00000 - "invalid SQL statement"
* Cause:
* Action:
Vendor code 900Error at Line: 2
编辑4:
我正在尝试运行一个过程,其定义如下所示:
create or replace procedure get_account
(
Vret_val out number,
Vtran_count in out number,
Vmessage_count in out number,
Vaccount_id IN NUMBER
, rc1 in out sys_refcursor
)as
begin
...
我收到一个错误:
Error starting at line 2 in command:
exec :rc := get_account(1)
Error report:
ORA-06550: line 1, column 24:
PLS-00306: wrong number or types of arguments in call to 'GET_ACCOUNT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
rc
------
我是如此接近......请帮助。
*编辑5:*
我正在运行的脚本(功能相同),错误始终相同:
var ret1 number
var tran_cnt number
var msg_cnt number
var rc refcursor
exec :tran_cnt := 0
exec :msg_cnt := 123
exec get_account(Vret_val => :ret1, Vtran_count => :tran_cnt, Vmessage_count => :msg_cnt, Vaccount_id => 1, rc1 => rc)
脚本输出(在 F5 上)(可能是来自多次运行的几条消息。):
Error report:
ORA-06550: line 1, column 134:
PLS-00201: identifier 'RC' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
anonymous block completed
anonymous block completed
Error starting at line 7 in command:
exec get_account(Vret_val => :ret1, Vtran_count => :tran_cnt, Vmessage_count => :msg_cnt, Vaccount_id => 1, rc1 => rc)
Error report:
ORA-06550: line 1, column 134:
PLS-00201: identifier 'RC' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
anonymous block completed
anonymous block completed
Error starting at line 7 in command:
exec get_account(Vret_val => :ret1, Vtran_count => :tran_cnt, Vmessage_count => :msg_cnt, Vaccount_id => 1, rc1 => rc)
Error report:
ORA-06550: line 1, column 134:
PLS-00201: identifier 'RC' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
为什么它说第 1 行第 134 列?没有一条线延伸那么远......