Handling a DDL statement
The mi_get_result() function returns a status of MI_DDL to indicate that the current statement was a DDL statement that has successfully executed. When you receive the MI_DDL statement status, you can use the mi_result_command_name() function to obtain the name of the DDL statement that executed as the current statement.
The mi_get_result() function returns an MI_DDL
status for any SQL statement that is valid in a UDR and is not a DML
statement (see Table 1). For
example, mi_get_result() returns the MI_DDL status
for a GRANT statement, even though SQL does not strictly consider
GRANT as a DDL statement. However, the following SQL statements are
not valid with a UDR that is called from within an INSERT, UPDATE,
or DELETE statement in SQL:
- ALTER ACCESS_METHOD
- ALTER FRAGMENT
- ALTER FUNCTION
- ALTER INDEX
- ALTER PROCEDURE
- ALTER ROUTINE
- ALTER SEQUENCE
- ALTER SECURITY LABEL COMPONENT
- ALTER TABLE
- CLOSE DATABASE
- CREATE ACCESS_METHOD
- CREATE AGGREGATE
- CREATE CAST
- CREATE DATABASE
- CREATE DISTINCT TYPE
- CREATE DUPLICATE
- CREATE EXTERNAL TABLE
- CREATE FUNCTION
- CREATE FUNCTION FROM
- CREATE INDEX
- CREATE OPAQUE TYPE
- CREATE OPCLASS
- CREATE PROCEDURE
- CREATE PROCEDURE FROM
- CREATE ROLE
- CREATE ROUTINE FROM
- CREATE ROW TYPE
- CREATE SCHEMA
- CREATE SECURITY LABEL
- CREATE SECURITY LABEL COMPONENT
- CREATE SECURITY POLICY
- CREATE SEQUENCE
- CREATE SYNONYM
- CREATE TABLE
- CREATE Temporary TABLE
- CREATE TRIGGER
- CREATE VIEW
- CREATE XADATASOURCE
- CREATE XADATASOURCE TYPE
- DROP ACCESS_METHOD
- DROP AGGREGATE
- DROP CAST
- DROP DATABASE
- DROP DUPLICATE
- DROP FUNCTION
- DROP INDEX
- DROP OPCLASS
- DROP PROCEDURE
- DROP ROLE
- DROP ROUTINE
- DROP ROW TYPE
- DROP SECURITY
- DROP SEQUENCE
- DROP SYNONYM
- DROP TABLE
- DROP TRIGGER
- DROP TYPE
- DROP VIEW
- DROP XADATASOURCE
- DROP XADATASOURCE TYPE
- MOVE
- RENAME COLUMN
- RENAME DATABASE
- RENAME INDEX
- RENAME SECURITY
- RENAME SEQUENCE
- RENAME TABLE
- TRUNCATE
- UPDATE STATISTICS
For any valid DDL statement, the mi_get_result() loop
returns the following states of the database server:
- An MI_DDL status indicates that the SQL statement has successfully completed.
- In the next iteration of the mi_get_result() loop, mi_get_result() returns MI_NO_MORE_RESULTS.