SQL/MX 2.x Installation and Management Guide (G06.24+, H06.03+)

Adding, Altering, and Dropping SQL/MX Database
Objects
HP NonStop SQL/MX Installation and Management Guide523723-004
9-17
Adding Views
force automatic recompilation. If they will, you should SQL compile these modules
after making the changes to avoid expensive automatic recompilations at run time.
SQL applications that are running while you make these changes will still undergo
automatic recompilation.
For information about explicit and automatic recompilation, see the SQL/MX
Programming Manual for C and COBOL and the SQL/MX Programming Manual for
Java. For information about using DISPLAY USE OF, see Checking Module
Dependencies With DISPLAY USE OF on page 11-20 and the SQL/MX Reference
Manual.
5. Enter the CREATE TRIGGER statement.
6. Revise the application source code as needed to reflect your changes to the
database. Process and compile the updated source file. For more information, see
the SQL/MX Programming Manual for C and COBOL and the SQL/MX
Programming Manual for Java.
For more information and examples of creating triggers, see Creating Triggers on
page 7-39.
Adding Views
To add a view, use the CREATE VIEW statement.
Steps for Adding a View
1. Start an MXCI session. Enter a LOG command to initiate a log file for statements
and commands entered in this session. Keep the log for your records.
2. Determine the names of any tables whose columns you want to include in the
view., and a name for the view you want to add.
3. Query the system metadata to ensure the new view name is unique among
existing view, table, SQL/MP alias and SPJ names in the schema.
4. Determine the column names of the view and the column names of the underlying
table or tables of the view. To display the columns of the underlying table or tables,
you can use MXCI as described in Displaying the Attributes of a Column on
page 8-56.
5. Enter the CREATE VIEW statement.
6. Use the GRANT statement to set access privileges for the new view, if necessary.
7. Make a new TMF online dump containing the view.
For more information and examples of creating views, see Creating Views of SQL/MX
Tables on page 7-37 and the SQL/MX Reference Manual.