dan
dan

Reputation: 41

Call plsql procedure with out parameter = null

I heed to call a procedure from PLSQL developer sql window. My request script is:

begin
someProcedure(arg1 => 22222,
              arg2 => 0,
              arg3 => arg3)
end

arg1 and arg2 have "in" type, arg3 has "out" type. Declaration of procedure is like:

procedure someProcedure(arg1 in number,
                        arg2 in number,
                        arg3 out number)

When i tested this procedure at test window, i could give just arg1 and arg2, and let arg3 be like arg3 := arg3, but when i was trying to call procedure from sql window with a script above, i've got error about declaration of variables.

arg3 is optional parameter and actually i don't know what it is should be.

Here is 3 cases of errors i've had:

  1. arg3 => arg3 error: id of arg3 should be declared
  2. arg3 => :arg3 error: ora-01008
  3. arg3 => out number error: ora-06550
  4. arg3 => null error: pls-00306

How can i call procedure from sql window with arg3 parameter which is equall null?

Upvotes: 0

Views: 1484

Answers (1)

Littlefoot
Littlefoot

Reputation: 142798

As it is an OUT parameter, you have to have "something" to put that value into. One option is a local variable:

declare
  l_out number;                       --> why NUMBER? You said so
begin
  someProcedure(arg1 => 22222,
                arg2 => 0,
                arg3 => l_out);       --> use it here
end;

Upvotes: 2

Related Questions