SQL/MP Programming Manual for COBOL

Program Invalidation and Automatic SQL
Recompilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
8-2
Causes of Program Invalidation
Causes of Program Invalidation
Program invalidation is caused by certain operations performed on the program file
and by DDL operations that alter an SQL object that the program references. During
program invalidation, the SQL catalog manager performs these operations:
Sets the VALID flag to N in the PROGRAMS catalog table and in the program’s file
label if the program file is accessible
Deletes the program’s usages entries in the USAGES table
An invalid SQL program must be recompiled either explicitly or automatically to
generate valid execution plans before it can execute.
Operations Performed on an SQL Program File
These operations performed on an SQL program file cause the program file to be
invalidated:
Copying a program file. If you copy a program file by using the FUP or SQLCI DUP
command, the original file is unaffected, but the new file is invalid.
Binding or linking a program file. If you explicitly bind a program file by using the
Binder program or link a program file by using the nld or ld utility, the original file
is unaffected, but the resulting target file is invalid.
Restoring a program file. If you restore a program file by using the RESTORE
program without specifying the SQLCOMPILE ON option, the restored program
becomes invalid.
Running the Accelerator on a program file. If you run the Accelerator to optimize
the object code, the program file becomes invalid.
Changes to Referenced SQL Objects
These changes to an SQL object cause a program file that references the object to be
invalidated, except as described in Preventing Program Invalidation
on page 8-4:
Adding an index to a table, including an underlying table of a protection or
shorthand view, by using the CREATE INDEX statement without the
NO INVALIDATE option
Adding a constraint, column, or partition on a table, including an underlying table of
a protection or shorthand view
Dropping a table or view
Dropping a partition on a table or index
Dropping an index or constraint on a table
Moving a partition on a table
Enabling or disabling the similarity check for a table or protection view