Procedure

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Thu, 02 Dec 2010 3:42 pm

Can anyone give me a hint.
How do I perform a procedure inside another and return the records of this procedure that was called to the procedure that calls?


Since already thank you for your attention.
Marlon Jardel
Location: Igrejinha RS

Marlon Jardel

Poston Thu, 02 Dec 2010 3:55 pm

victorhugomuniz
Location: Rio de Janeiro - RJ

Jesus está voltando, volte antes para Ele.

Image JavaBlackBelt

Poston Thu, 02 Dec 2010 6:58 pm

It sounds to Me like you want something like using REF CURSOR output parameter of the procedure.

Put a little more information about the problem, what you need to solve, instead of the solution that you thought. Maybe rethink the simplest solution, looking from another angle.
fsitja
Location: Gaúcho no Rio de Janeiro - RJ

"The scars exist to remind us that the past was real"
Campanha: Como fazer uma pergunta e obter uma resposta.
http://tkyte.blogspot.com/2005/06/how-t ... tions.html

OCA & OCP Developer — OCE SQL Expert — OCS Data Warehousing Specialist

Poston Fri, 03 Dec 2010 7:59 am

the procedure is + or-.


create procedure X (p1, p2) variables begin ... ... ... run procedure_chamada (P1, P2);
return value;

... ... end;
Marlon Jardel
Location: Igrejinha RS

Marlon Jardel

Poston Fri, 03 Dec 2010 8:20 am

You just need your procedure call holds an out-type parameter.
Dae the field that you pass this parameter will return what you want the procedure.

An example:
Code: Select all
create procedure chamada(p1 in number,p2 out boolean) is
begin
  if p1 = 1 then
    p2:= true;
  else
    p2 := false;
  end if;
end;

SergioLBJr
Location: Parobé - RS

Sérgio Luiz Bonemberger Junior
Programador Junior
Parobé RS

[]s

Poston Fri, 03 Dec 2010 8:43 am

Yes, but what is the command I use to call this procedure, I created it with 4 parameters, 3 of them are in (input) and 1 out (leaving) I am running it as follows: nome_procedure (p1, p2, p3); These are the input parameters, now I want to play within a variable in another procedure output parameter. How do I do it.


When calling the procedure as I put above, she accuses an error: incorrect number of arguments in the call to nome_procedure.
Marlon Jardel
Location: Igrejinha RS

Marlon Jardel

Poston Fri, 03 Dec 2010 9:25 am

Thanks for the help guys.
Found another forum topic that solved my problem viewtopic.php?t=805&highlight=parametros+out when passing the parameters to the procedure, I should inform the input parameters and a variable that will receive the output value of the procedure.
EX: nome_procedure (entrada1, in2, entrada3, variavel_que_recebe_saida);

Thanks for the attention.
Marlon Jardel
Location: Igrejinha RS

Marlon Jardel

Poston Mon, 10 Jan 2011 12:05 am

To call a procedure inside another simply declare the procedure inside the section \"declare\" the PL/SQL block.

Example:
Code: Select all

create or replace procedure prc_externa (pA in, pB in) is

declare
 
  -- Minha procedure interna
  procedure  prc_interna(p1 in, p2 out) is

  begin
    aqui vai meu código;
  end prc_interna;

  var_out varchar2(10);

begin

  -- aqui chamo minha proc interna
  prc_interna('valor 1',var_out); 

end prc_externa;
gpilger
Location: Novo Hamburgo - RS

Gilson Pilger
"Por não saber que erra impossível, ele foi lá e fez" autor desconhecido


  • See also
    Replies
    Views
    Last Post


    Return to PL/SQL

    Who is online

    Users browsing this forum: No registered users and 4 guests