SQL/MP Programming Manual for COBOL

Data Retrieval and Modification
HP NonStop SQL/MP Programming Manual for COBOL529758-003
4-3
Recovering From SQL Error 8204
ALTER INDEX with LOCKLENGTH
ALTER VIEW with RENAME
CREATE CONSTRAINT and CREATE INDEX
DROP CONSTRAINT, DROP INDEX, DROP TABLE,
or DROP VIEW (protection view only)
UPDATE STATISTICS
COPY, LOAD, PURGEDATA, or RESTORE utility operation
(A disk or network line that goes down and then comes back up can also cause the
system to terminate a program’s open.)
3. The program tries to execute another SQL statement for the table or view.
4. The SQL executor tries to recover, as described in the next subsection. However, if
it cannot recover from the error, the executor returns error -8204 to the program,
and the program loses its open for the table or view.
Recovering From SQL Error 8204
If a program executes a static DML statement and the open for a table or view it is
using has been lost because of a DDL statement or utility operation, the SQL executor
tries to recover as described in this subsection.
Simple DML Statements
For static DML statements (SELECT, INSERT, UPDATE, and DELETE), the SQL
executor reopens the changed table or view and then retries the DML statement once
using the new definition of the table or view. If the retry is successful, the SQL executor
returns a warning (8204) to the program. However, if the retry fails, the SQL executor
returns an error (-8204).
To recover from SQL error -8204 for a simple DML statement, a program might need to
abort 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 by 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: