SQL/MP Programming Manual for C

Data Retrieval and Modification
HP NonStop SQL/MP Programming Manual for C429847-008
4-4
Single-Row SELECT Statement
To recover from SQL error -8204 for a simple DML statement, a program might need to
abnormally terminate the transaction and restart the operation from its beginning.
Because some DDL changes can invalidate a DML statement, the SQL executor might
first need to recompile the DML statement to use the new definition of the changed
table or view. In some cases, the similarity check can prevent recompilation. For more
information, see Section 8, Program Invalidation and Automatic SQL Recompilation.
If the program does not allow automatic recompilation (the NORECOMPILE option is
set), the SQL executor returns error -8027. In this case, you must explicitly recompile
the program using the new definition of the table or view.
Static Cursor Operations
For a static cursor operation, the SQL executor tries to reestablish the open in these
situations:
The program has not yet opened the cursor.
The program has opened the cursor, but the OPEN CURSOR statement did not
require any input host variables, and the first FETCH statement has not yet been
run.
However, if the problem occurs on a FETCH statement, the SQL executor closes the
cursor and returns error -8204. The program must then close and reopen the cursor
before executing a subsequent FETCH statement. The program might need to
abnormally terminate the transaction and restart the cursor operation from its
beginning.
Single-Row SELECT Statement
A single-row SELECT statement retrieves a single row of data from one or more tables
or views and places the column values into corresponding host variables.
To select a set of rows, one row at a time using a cursor, see Using SQL Cursors
on
page 4-14.
To run a SELECT statement, a process started by the program must have read access
to all tables, protection views, and the underlying tables of any shorthand views used in
the statement. For details, see Required Access Authority on page 7-1.
Do not use an asterisk (*) in a SELECT statement in a C program. A SELECT
statement with an asterisk always assigns columns in the result table from the current
definition of the referenced tables or views. If columns have been added to a table, the
retrieved data values might not be in the expected order.