SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)

Name Resolution, Similarity Checks, and Automatic
Recompilation
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL663854-005
8-17
Similarity Check
In this example, run-time view 1 passes the view similarity check, because
PRDCAT.SCH_ONE.tab1 is mapped to CAT.SCH.TABLE_ONE, and
PRDCAT.SCH_ONE.tab2 is mapped to CAT.SCH.TABLE_TWO correctly.
Compile-time view:
CREATE VIEW PRDTEMP_VIEW AS
SELECT I, J, B
FROM CAT.SCH.TABLE_ONE, CAT.SCH.TABLE_TWO
WHERE TABLE_TWO.B = 'A' AND TABLE_ONE.B = 1;
Run-time view 1:
CREATE VIEW PRDTEMP_VIEW AS
SELECT I, J, B
FROM PRDCAT.PRDSCH_ONE.TAB1, PRDCAT.PRDSCH_ONE.TAB2
WHERE TAB2.B = 'A' AND TAB1.I = 1;
Run-time view 2:
CREATE VIEW PRDTEMP_VIEW AS
SELECT I, J, B
FROM PRDCAT.PRDSCH_ONE.TAB1, PRDCAT.PRDSCH_ONE.TAB2
WHERE TAB1.I = 1 AND TAB2.B = 'A';
However, in run-time view 2, positions of the predicates do not match the compile-
time view. Since the positions do not match, a difference exists between the view
text in addition to the difference in the table names. Therefore, run-time view 2 fails
the view similarity check.
If a statement fails the similarity check, the SQL/MX executor, by default, invokes the
SQL/MX compiler to automatically recompile the SQL plan. For more information, see
Automatic Recompilation on page 8-18.