SQL/MP Installation and Management Guide
The SQL/MP Database Management Environment
HP NonStop SQL/MP Installation and Management Guide—523353-004
1-4
Active Data Dictionary
Figure 1-1 shows typical use of a data dictionary. DDL statements and the SQL
compiler access both the catalogs and the file labels, but SQL compiled programs
access only the file labels of objects during program execution. An executing program
requires catalog access only when the program requires automatic recompilation.
To understand how the active dictionary affects programs, consider the effect of adding
a constraint on a table. Suppose that your company has reorganized the boundaries of
its sales divisions, and your division no longer includes the state of New York. As a
result of the reorganization, all your New York customers have been given to the other
division and have been removed from your database.
The database includes a CUSTOMER table with a STATE column. Now you can add a
constraint to prohibit adding any customers from New York. A constraint specifies a
rule that rows in a table must satisfy. The statement to create the constraint follows:
CREATE CONSTRAINT CUSTOMER_NEW_YORK
ON CUSTOMER CHECK STATE <> 'NEW YORK'
After this constraint is entered, either through SQLCI or through an application
program, no user can add a customer from the state of New York. SQL/MP enforces
this constraint. No programmatic changes are necessary to protect the database
against adding an invalid customer.
The RDBMS ensures that every program uses the current table definition by requiring
SQL recompilation of every program that uses the CUSTOMER table. When you do
Figure 1-1. Typical Use of the Data Dictionary
Data Dictionary
ALTER, CREATE, DROP, CONTROL
Register program in catalog
DML
VST001.vsd
Database
Administrator
Application
Programmer
Transaction
Originator
Catalog
Tables
File
Labels
SQL
DDL
DCL
SQL
Compiler
SQL OLTP
Application