Home » SQL & PL/SQL » SQL & PL/SQL » Ajuda com procedure Type Pipilined (Oracle)
Ajuda com procedure Type Pipilined [message #678101] Mon, 11 November 2019 04:10 Go to previous message
cristine_katia
Messages: 24
Registered: November 2013
Location: SÃO PAULO
Junior Member
Bom dia pessoal.

Sou nova em BI e estou desenvolvendo uma procedure com chamada de várias funções. Como faço para trazer estas informações da procedure executadas e o retorno das mesmas trazer dentro de um TYPE PIPELINED? Esta informação tipo consulta ,sera uma consulta em front. Não estou conseguindo montar este Pl-sql.
Estou enviando um simples exemplo como quero.

Agradeço pela ajuda.

--Procedure

create or replace PROCEDURE proc_teste ( p_ISS IN number,
p_COFINS IN number,
P_IR IN number,
P_IMPOSTO IN number,
P_TAXA IN number ) AS

v_num1 NUMBER := 0;
v_num2 NUMBER := 0;
v_num3 NUMBER := 0;

BEGIN

--FUNCTION 1
v_num1 := fn_ISS( p_iss , p_COFINS );

--FUNCTION 2
v_num2 := fn_ir( P_IR, P_IMPOSTO);

--FUNCTION 3
v_num3 := fn_taxa( P_TAXA, P_IMPOSTO, p_ISS );



END;




---PIPELINED

create or replace procedure RETORNO

FUNCTION BUSCA_RETORNO( v_num1,
v_num2,
v_num3 )

RETURN RETORNO_TYPES.t_simulador_tab PIPELINED

IS

v_row t_simulador_row;

v_tab t_simulador_tab := t_simulador_tab();

TYPE t_row_inicial IS RECORD( v_num1,
v_num2,
v_num3);

v_row_inicial t_row_inicial;

TYPE t_inicial IS TABLE OF t_row_inicial;

v_tab_inicial t_inicial := t_inicial();


BEGIN


FOR i IN v_tab_inicial.first..v_tab_inicial.last LOOP


--Agora alimentamos o v_row a ser retornado

v_row.v_num1 := v_tab_inicial(i).v_num1;
v_row.v_num2 := v_tab_inicial(i).v_num2;
v_row.v_num3 := v_tab_inicial(i).v_num3;

PIPE ROW(v_row);

END LOOP;

END BUSCA_RETORNO;

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: AWR Report SQL with Bind Variables
Next Topic: problem to show result in join tables
Goto Forum:
  


Current Time: Thu Mar 28 20:36:03 CDT 2024