Re: FETCH all the records in the table

From: Shankar Ramanathan <srnathan_at_amoco.com>
Date: 1996/03/26
Message-ID: <31583519.2950_at_amoco.com>#1/1


Ravi Kodali wrote:

Try semi global variables:

/* declare all the forward and common variables for this file */ void db_login();
..
..

 main() {
 db_login();
 db_open();
 get_rows();
> }

db_login() {
  EXEC SQL CONNECT :DB;
}

db_open() {
  EXEC SQL DECLARE users CURSOR FOR

     SELECT * FROM USER_INFO;     EXEC SQL OPEN users;
}

get_rows(row_num ;-) ) { /* you can be fancy fetching by row num */
  while(1) {             /* what happens if you hit the end-of file? */
                         /* 

    EXEC SQL WHENEVER NOT FOUND GOTO ERROR_COND;     EXEC SQL FETCH users INTO :structurename;     }
ERROR_COND:
    display_sql_error(); /* write the error handler...*/  } Received on Tue Mar 26 1996 - 00:00:00 CET

Original text of this message