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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 returning values of a LOOP statement

Author  Topic 

cutovoi
Starting Member

1 Post

Posted - 2002-11-04 : 11:28:33
hi for all

I have a answer:

In my report I have the following code;
IF :CONTAS = 'GRUPO' THEN
FOR cto IN cur_cta_des LOOP
IF (cto.cod_cta_fech_tfe = :cod_cta_ger_rch) THEN
return(:des_cta_fech_tfe);
END IF;
END LOOP;
END IF;
I want that code returns the values of the table below:

select distinct
DECODE(substr(b.cod_cta_ger_rch,1,3), ':GRUPO2',b.cod_cta_ger_rch,NULL),
DECODE(b.cod_cta_ger_rch, ':GRUPO', a.des_cta_fech_tfe),
DECODE(b.cod_cta_ger_rch, ':GRUPO', b.cod_cta_fech_rch),
c.cod_plano_cta_pco,
a.dta_inic_val_tfe,
a.sta_som_cta_tot_tfe,
c.cod_roti_ctb_pco,
c.sta_som_sub_pco,
c.cod_cta_ger_tot_pco,
c.cod_cta_fat_pco,
c.sta_som_sub_ctb_pco,
c.sta_atv_pco,
c.cod_cta_parc_pco,
c.cod_plano_cta_pco,
c.des_plano_cta_pco
from tab_contas_fech a,
rel_contas_fech b,
tab_plcont_oper c
WHERE a.cod_cta_fech_tfe = b.cod_cta_fech_rch
&data

the code is right, but whn I compile my report the following message appears to me:
"The following bind variable is not defined: cod_cta_ger_rch"
"The following bind variable is not defined: des_cta_fech_tfe"

This messages appears because the Reports thinks that the field not is there, bacause the DECODE statement this thing occurs, but I need the DECODE because my other report exert this fields. Ora it uses, ora not!

Please, who can help me?

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-11-04 : 11:48:30
Moved to the Developer forum.

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-11-04 : 11:51:46
What language are you using?....this site mainly deals with MicroSoft SQLServer questions....(and not SQL in the general sense)



you also say..."compile my report"....yet fail to say what 'development environment/tool' you are using.....


if you supply more info.....you may get more help here....otherwise you may be re-directed to another site....(is this ORACLE code???)

Go to Top of Page

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-11-04 : 11:51:48
what language is this? looks like access maybe?

-----------------------
SQL isn't just a hobby, It's an addiction
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-11-04 : 11:54:49
It's Oracle PL/SQL. You'll have better luck posting your question in an Oracle forum. Might do better here:

http://dbforums.com/

Go to Top of Page
   

- Advertisement -