Informix nonupdatable cursors

Declaring a cursor is similar to declaring a variable; a cursor is a nonexecutable statement just like a variable declaration. The first step in declaring a nonupdatable cursor is to define how the result set looks. To do this, you need a SELECT statement. You must associate the result set with a logical name so you can refer to it in subsequent SQL statements.


Assume the SingleLineEdit control sle_1 contains the state code for the retrieval:

The script for the Clicked event for the CommandButton Cb_Extract is:

// Declare cursor emp_curs for employee table.
// retrieval

   SELECT emp_id, emp_name FROM Employee 
   WHERE emp_state = :sle_1.text;

// Declare local variables for retrieval.
string   emp_id_var
string   emp_name_var

// Execute the SELECT statement with 
// the current value of sle_1.text.
OPEN emp_curs;

// At this point, if there are no errors, 
// the cursor is available for further processing.