Mega
Mega

Reputation: 565

Use value of stored procedure in another stored procedure in PLSQL

Is there any way of calling a stored procedure from another stored procedure, and use retrieved value (from the second procedure) back in the first one?

Upvotes: 2

Views: 146

Answers (1)

Nick Krasnov
Nick Krasnov

Reputation: 27251

-- procedure #1
create or replace procedure Proc1(p_RetValue out SomeDataType) 
is
begin
  -- any logic goes here
  p_retValue := 5+5; -- for example. Let's assume that the SomeDataType is number;   
end;

-- second procedure 
create or replace procedure Proc2 is
  l_variable number;
begin
  Proc1(l_variable);  -- the value 10 will be assigned to l_variable;
end; 

Upvotes: 2

Related Questions