How to run the following Oracle exec statements in SQL Developer?
I have came across these statements which are supposed to be run in Oracle, however I am not sure how these statements should be run. Tried running them as SQL but doesn't work.
variable output1 NUMBER;
variable output2 VARCHAR2(100);
exec rp_orader_closure_pxkg.rp_exaec_close_SILvl_WKO('aaa',
开发者_JS百科 '1',
'10aaa001a6414339',
:output1, :output2);
I'm not sure all the SQLPlus commands work in SQL Developer. You can certainly do that in an anonymous block:
DECLARE
output1 NUMBER;
output2 VARCHAR2(100);
BEGIN
rp_orader_closure_pxkg.rp_exaec_close_SILvl_WKO('aaa', '1',
'10aaa001a6414339', output1, output2);
END;
It works fine for me, SQL Developer v3.0.04. In the script window, I enter:
create or replace package p as
procedure prc (p1 in varchar2, p2 in out varchar2);
end;
/
create or replace package body p as
procedure prc (p1 in varchar2, p2 in out varchar2) is
begin
p2 := p1;
end prc;
end;
/
variable output2 VARCHAR2(100);
exec p.prc('aaa',:output2);
print output2;
In the script output window:
PACKAGE p compiled
PACKAGE BODY p compiled
anonymous block completed
OUTPUT2
---
aaa
Perhaps I'm missing something?
Just lose the first two lines and execute only the line with exec
at the beginning. SQL developer will ask you for the values of the variables. Just leave them NULL
, as they are output parameters.
精彩评论