0

我正在尝试SQL*PLUSORACLE.

  • 创建变量
  • 将其作为输出变量传递给我的方法调用
  • 打印输出变量的值

我明白了

未声明的变量

错误。我正在尝试创建一个在会话中持续存在的变量,直到我关闭SQL*PLUS窗口。

variable subhandle number;
exec MYMETHOD - (CHANGE_SET => 'SYNC_SET', - DESCRIPTION => 'Change data for emp', 
                                           - SUBSCRIPTION_HANDLE => :subhandle);

print subhandle;
4

3 回答 3

3

It should be OK - check what you did carefully against this:

SQL> create procedure myproc (p1 out number)
  2  is
  3  begin
  4     p1 := 42;
  5  end;
  6  /

Procedure created.

SQL> variable subhandle number
SQL> exec myproc(:subhandle)

PL/SQL procedure successfully completed.

SQL> print subhandle

 SUBHANDLE
----------
        42
于 2008-09-24T16:42:59.720 回答
0

Please can you re-post, but formatting the code with the code tag.... (ie the 101 010 button) I think some extra "-" characters came through which means it more difficult to interpret.

Might also be helpful to see SQLPlus reporting the error if you could copy the contents of the SQLPlus window instead/too?

But it looks correct.

于 2008-09-24T16:41:07.153 回答
0

我不确定这是否是您要查找的内容,但是您尝试过&&variable语法吗?你可以做

select &&subhandle from dual

或脚本开头的一些类似的东西,那么subhandle应该在会话的其余部分绑定到该值。

于 2008-09-25T17:59:02.853 回答