SQL/MP Programming Manual for COBOL

Program Invalidation and Automatic SQL
Recompilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
8-13
Preventing Automatic Recompilations
asterisk (*), RUN-TIME-TABLE must have the same number of columns as
COMPILE-TIME-TABLE. For more information, see the next subsection.
Similarity Rules for Protection Views
The similarity check does not support shorthand views. The similarity rules for
protection views are:
A protection view is never similar to a table or other SQL object.
To pass the similarity check, two protection views must follow this criteria:
Have similar underlying base tables
Project the same columns from the base tables
Have the same column names
Have the same selection expression, which is determined by a binary
comparison of the generated objects for the two selection expressions
ALTER TABLE... ADD COLUMN Statement and the Similarity
Check
Two tables are not required to have the same number of columns to pass the similarity
check, but tables with a different number of columns must observe these restrictions
(as well as the other similarity check rules) to pass the check:
The number of columns in COMPILE-TIME-TABLE must be less than or equal to
the number of columns in RUN-TIME-TABLE.
The common columns of the tables must have identical attributes. For example,
if COMPILE-TIME-TABLE has five columns, RUN-TIME-TABLE can have more
than five columns, but the first five columns of each table must be identical.
Therefore, you can use the ALTER TABLE ... ADD COLUMN statement for a table
without forcing the recompilation of a program that accesses the table. However, these
cases show several problems that can occur when you use the ALTER TABLE ... ADD
COLUMN statement and the similarity check.
An SQL statement uses an asterisk (*) in a select list with the similarity check for tables
with a different number of columns as shown in these statements:
Statement Similarity Check Results
SELECT * FROM table1
TABLE1 = Fail
SELECT DISTINCT * FROM table1
TABLE1 = Fail
SELECT COUNT (*) FROM table1
TABLE1 = Pass
SELECT columna FROM table1
WHERE columnb relation-operator
(SELECT COUNT(*) FROM table2)
TABLE1 = Pass,
TABLE2 = Pass