Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews.google.com!h48g2000cwc.googlegroups.com!not-for-mail
From: "Big George" <jbeteta@gmail.com>
Newsgroups: comp.databases.oracle.misc
Subject: Help with Cursors !
Date: 8 Aug 2006 17:12:25 -0700
Organization: http://groups.google.com
Lines: 45
Message-ID: <1155082345.004794.247950@h48g2000cwc.googlegroups.com>
NNTP-Posting-Host: 200.37.211.162
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1155082350 11117 127.0.0.1 (9 Aug 2006 00:12:30 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 9 Aug 2006 00:12:30 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: h48g2000cwc.googlegroups.com; posting-host=200.37.211.162;
   posting-account=dtiEdwwAAAC0KyUNNIprRsbxGZ-jbNO9
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.misc:129153

Hello,

I need some help with code. I need to create and loop a cursor1 and
then use cursor2 in order to store the rows that I am selecting in
order to pass cursor2 for a datatable. Is that possible?

PROCEDURE My_SP(i_param IN INTEGER)
IS
 v_Field1  CHAR;
 v_rec     INTEGER;
 CURSOR Cursor1
 IS
 SELECT Field1
 FROM MyTable ;
BEGIN
 OPEN Cursor1;
   LOOP
   FETCH Cursor1 INTO v_Field1;
   EXIT WHEN Cursor1%NOTFOUND;

   SELECT count('x') INTO v_rec FROM OtherTables
   WHERE ThisField = v_Field1;
   IF v_rec > 0 THEN
         -- Here I have to store v_Field1 in some other cursor in order
to
         -- have a list that I will use to populate a datatable in
VB.NET
         -- So, I would like to construct Cursor_2 for doing something
like:
         -- CURSOR_2  OUT SYS_REFCURSOR
         -- OPEN CURSOR_2 FOR
        --            SELECT
             --             Field1,
          --              Field2,
        --           FROM CURSOR_2;
         --
         -- Is it necessary to INSERT in a real table ?
         -- How can I accomplish this, please?
      END IF;
   END LOOP;
 CLOSE Cursor1; 
END My_SP;

Thank you very much

