SQL/MX 3.2.1 Management Manual (H06.26+, J06.15+)

Steps for Adding an SQL/MX Table
1. Plan the column definitions, checking that the data type of any column that might be necessary
for join or predicate search operations matches the joined column.
2. 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.
3. Make sure your new table name is unique among existing table, view, SQL/MP alias, and
SPJ names in the schema.
4. Determine a name for the table you want to add.
5. Query the system metadata to ensure the new table name is unique among existing table,
view, SQL/MP alias and SPJ names in the schema.
6. Enter the CREATE TABLE statement.
7. Use the GRANT statement to assign access privileges on the new table to authorized users.
8. 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.
9. Perform a TMF online dump. For a partitioned table, perform an online dump of each partition.
For more information, see “Creating SQL/MX Tables” (page 80).
Adding Triggers
To add a trigger to an SQL/MX table, use the CREATE TRIGGER statement.
User applications that change (INSERT, UPDATE, or DELETE) information in a table are automatically
recompiled when a trigger with a matching event is added or dropped. User applications that use
a SELECT on the subject table do not require recompilation. User applications require SQL
recompilations only when triggers are added, altered or dropped. No source code changes or
language compilations are required.
For more information, see the SQL/MX Reference Manual.
Steps for Adding a Trigger
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 name of the table to which you want to add the trigger.
3. Query the system metadata to ensure the new trigger name is unique among existing trigger
names defined in the schema.
4. Use the DISPLAY USE OF command to identify which user modules are associated with this
object. See the similarity check criteria in the SQL/MX Programming Manual for C and COBOL
to determine if your changes are likely to cause similarly check to fail and 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 more information about explicit and automatic recompilation, see the SQL/MX Programming
Manual for C and COBOL. For more information about using DISPLAY USE OF, see “Checking
Module Dependencies with DISPLAY USE OF” (page 226)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.
For more information, see “Creating Triggers” (page 102).
Adding Views
To add a view, use the CREATE VIEW statement.
Adding Objects to an SQL/MX Database 161