【发布时间】:2011-03-09 06:35:15
【问题描述】:
* 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
EDIT4:
我正在尝试运行一个过程,其定义如下:
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 列?没有线延伸那么远......
【问题讨论】:
-
在 SQLDeveloper 中运行过程有什么难的?您找到该过程,右键单击它,然后选择 Run(或按 Ctrl-F11),然后在它生成的 PL/SQL 块中指定参数。
-
好的,我也想看看存储过程的输出,谢谢。
-
为什么不把它作为一个问题来询问如何使用 SQL Developer?
-
@APC,因为我不相信它。请证明我错了。
-
我重新命名了你的问题,因为我认为我们已经到了不再需要好斗的语气的地步。我已经处理了您的第四次编辑
标签: oracle stored-procedures plsql oracle-sqldeveloper sys-refcursor