Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FOR LOOP - Help

604320May 26 2008 — edited May 28 2008
hi guys, im a junior developer and i need your help here :

im querying a meaning of account segments from many tables in oracle apps EBS,

segments from table1 segment 1,segment2,segment3
are like 11,112546,000001

and their meaning is like
11 TEST
112546 COMPANY1
000001 ACCOUNTING

from another table

i need both of em in 1 report with parameter related to segments which is
CODE_COMBINATION_ID

and to concatenate the segments and thier meaning like this :
11112546000001
TESTCOMPAN1ACCOUNTING

i made this function but its not giving me any results...
i think the error is in the loop .. please advice..


CREATE OR REPLACE Function accountdesc ( code_in IN varchar2 )
RETURN varchar2
IS
s1 varchar2(25);
s2 varchar2(25);
s3 varchar2(25);
s4 varchar2(25);
s5 varchar2(25);
acc varchar2(25);
accdesc varchar2(150);

BEGIN

select segment1,segment2,segment3,segment4,segment5
into s1,s2,s3,s4,s5
from GL_CODE_COMBINATIONS
where CODE_COMBINATION_ID = code_in;

FOR i in s1..s5 LOOP
accdesc:= accdesc||acc;
select ffvt.DESCRIPTION into acc
from fnd_flex_value_sets ffvs, FND_FLEX_VALUES ffv, FND_FLEX_VALUES_TL ffvt
where ffvs.FLEX_VALUE_SET_ID = ffv.FLEX_VALUE_SET_ID
and ffv.FLEX_VALUE_ID = ffvt.FLEX_VALUE_ID
and ffvt.FLEX_VALUE_MEANING = i
and ffvt.LANGUAGE = 'US';

END LOOP;

RETURN accdesc;

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2008
Added on May 26 2008
5 comments
448 views