Cursor Value to Delimited String Variable??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M. Guest

    Cursor Value to Delimited String Variable??

    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
  • M. Guest

    #2
    Re: Cursor Value to Delimited String Variable??

    Thank you everyone for the responses, I actually don't have a manual
    :) Just been doing some research on web and wasn't able to find many
    good resources, so I decided to ask all the friendly people on these
    listservs.

    Sincerely,
    Michelle

    Comment

    • Daniel Roy

      #3
      Re: Cursor Value to Delimited String Variable??

      The best resource you can get for PL/SQL is the PL/SQL manual at
      tahiti.oracle.c om (you'll need a username/password, but it's free).

      Daniel

      mutantstar@hotm ail.com (M. Guest) wrote in message news:<4a37bfc4. 0309050622.2a5e 72b6@posting.go ogle.com>...
      Thank you everyone for the responses, I actually don't have a manual
      :) Just been doing some research on web and wasn't able to find many
      good resources, so I decided to ask all the friendly people on these
      listservs.
      >
      Sincerely,
      Michelle

      Comment

      Working...