Home » SQL & PL/SQL » SQL & PL/SQL » passing string value into a cusrsor (Oracle 10.2.0.4, windows)
passing string value into a cusrsor [message #382405] Thu, 22 January 2009 03:29 Go to next message
saikumar_mudigonda
Messages: 23
Registered: June 2008
Location: hyderabad
Junior Member
Hi All,

I need a help with the below plsql block, the problem i am facing is string1 value is coming perfectly as i expected (ex: '1','2','3'), but c2 cursor is fetching correct number of recrods.

DECLARE
   CURSOR c1
   IS
      SELECT   GROUP_ID
        FROM   header
       WHERE   col1 = 100;

   CURSOR c2 (grp header.GROUP_ID%TYPE)
   IS
      SELECT   groupid
        FROM   header
       WHERE   col1 = 9;

   string    VARCHAR2 (1000) := '''';
   string1   VARCHAR2 (1000) := '''';
BEGIN
   FOR c11 IN c1
   LOOP
      IF c1%ROWCOUNT = 1
      THEN
         string := '''' || c11.GROUP_ID;
      ELSE
         string := string || ''',''' || c11.GROUP_ID;
      END IF;
   END LOOP;

   IF string = ''','''
   THEN
      string := '''XXXXX''';
   ELSE
      string := string;
   END IF;

   SELECT   CONCAT (string, '''') INTO string1 FROM DUAL;

   FOR c22 IN c2 (string1)
   LOOP
      DBMS_OUTPUT.put_line ('passed');
   END LOOP;
END;


Please help me with a possible solution.

thanks
Re: passing string value into a cusrsor [message #382408 is a reply to message #382405] Thu, 22 January 2009 03:30 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This question has been asked many and many times and last time was yesterday.
Please SEARCH BEFORE posting.

Regards
Michel
Previous Topic: Total of a column at each page end and Grand total at the end of report.
Next Topic: REGEXP_LIKE vs LIKE
Goto Forum:
  


Current Time: Sun Dec 04 20:52:50 CST 2016

Total time taken to generate the page: 0.13317 seconds