Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 variable value (p_procedure) in a table, help me

Author  Topic 

suicinha
Starting Member

1 Post

Posted - 2010-09-09 : 10:47:44
Hi!

I got the following procedure:

CREATE OR REPLACE PROCEDURE PICAGE."SP_AGE_SEM_GEST" (
p_procedure OUT VARCHAR2,
p_periodo_calc IN NUMBER := 201006001)
IS
v VARCHAR2 (32766);

CURSOR ent_vend
IS
SELECT DISTINCT ent_com.cod_ent_vend
FROM tbl_ref_funcao func, tbl_conf_hier_comercial_teste hier INNER JOIN tbl_conf_ent_comercial_teste ent_com
ON ( hier.id_conf_ent_comercial = ent_com.id_conf_ent_comercial
AND hier.id_conf_cal_periodo_calc =
ent_com.id_conf_cal_periodo_calc
)
LEFT OUTER JOIN tbl_conf_hier_comercial_teste hier1
ON ( hier.id_conf_ent_comercial_pai =
hier1.id_conf_ent_comercial
AND hier.id_conf_cal_periodo_calc =
hier1.id_conf_cal_periodo_calc
)
WHERE hier.id_ref_canal = 1
AND hier.id_ref_funcao = 6
AND hier.id_conf_cal_periodo_calc = 201006001
AND hier1.id_ref_funcao <> 3;
BEGIN
FOR ev IN ent_vend
LOOP
v := v || ev.cod_ent_vend || ',';
END LOOP;

p_procedure := 'Entidade de Venda = ' || v;
DBMS_OUTPUT.put_line (p_procedure);
END sp_age_sem_gest;

I need to create another procedure to place the variable value (p_procedure) in a table, but one record per row of the table.

Can help me?

thnks

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-09-09 : 10:55:31
This is a SQL Server specific forum. You might have better luck in a forum that deals with your flavor of SQL. Also, if possible, you should use set based solutions instead of iterative ones.
Go to Top of Page
   

- Advertisement -