Re: Cursor Value to Delimited String Variable??

From: Ed prochak <ed.prochak_at_magicinterface.com>
Date: 4 Sep 2003 14:35:01 -0700
Message-ID: <4b5394b2.0309041335.64fa5d9e_at_posting.google.com>


mutantstar_at_hotmail.com (M. Guest) wrote in message news:<4a37bfc4.0309040730.52c2046b_at_posting.google.com>...
> Hello,
>
> I am fairly new to Oracle and PL/SQL, but I am trying to loop through
> some records and then insert a column value for each record into one
> variable, creating a comma-delimted string (for display on a report).
> I know the SQL part works, and I have it FETCHING ok, but the
> delimited part has me stumped. It is supposed to bring back 5 records
> and brings back only 4: 1 is empty and 2 are duplicates. Below is the
> section of my code that is supposed to do that--What am I doing wrong?
> Do I need to include more info to get the help I need?
>
> DECLARE s_AppSubType VarChar2(255);
> DECLARE x VarChar2(255);
> DECLARE y VarChar2(255);
>
> DECLARE CURSOR ApplicationFor IS
> SELECT InfoDesc
> FROM tbl1, tbl2
> WHERE tbl1.folderrsn = argFolderRSN
> AND tbl1.infocode = tbl2.infocode;
>
> FOR ApplicationFor_cur IN ApplicationFor LOOP
> FETCH ApplicationFor INTO y;
> x := x ||', '|| y;
> END LOOP;
> s_AppSubType := x;
>
> Sincerely,
> Michelle

Read your manual. You don't need to FETCH when using FOR..IN

HTH
  ed Received on Thu Sep 04 2003 - 23:35:01 CEST

Original text of this message