FETCH all the records in the table

From: Ravi Kodali <kodali_at_piglet.coe.missouri.edu>
Date: 1996/03/25
Message-ID: <4j76c2$1je0_at_news.missouri.edu>#1/1


Hi,

I need some help with the problem of fetching records in the tables in Pro*C.

I can declare a cursor like this...

main() {

getentry();
}

getentry() {  

 EXEC SQL CONNECT :DB;
 EXEC SQL DECLARE users CURSOR FOR

    SELECT * FROM USER_INFO;  EXEC SQL OPEN users;

 while(1) {

   EXEC SQL WHENEVER NOT FOUND DO break;    EXEC SQL FETCH users INTO :structurename;    }
}

  but if I want to return to main() after fetching the   first record and then comeback and fetch the second   record and so on... how do I do that. IF users is a   c structure, I would have had a pointer but users is   a SQL identifier and so how do I do that ? Once I quit   the getentry() function after fetching the first record   the function memory is gone and it is fresh for the next   call.

  Please let me know even if there is another way of doing   it.

  please reply to kodali_at_coe.missouri.edu and if u reply to   the posting it would bounce due to various reasons.

  thank you and please help me.

  Ravi

--
**********************************************************

* Programmer/Analyst (Oracle DBA) *
* Centre for Technology Innovations in Education *
* University of Missouri - Columbia *
* Columbia MO - 65211 *
* Tel # Home - (573)815-9176 *
* Off - (573)882-2162 *
* email - kodali_at_coe.missouri.edu *
**********************************************************
Received on Mon Mar 25 1996 - 00:00:00 CET

Original text of this message