This topic describes DDL operations on existing PL units, including CREATE, ALTER, and DROP operations.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition supports only MySQL-compatible mode.
CREATE [OR REPLACE]
CREATE [OR REPLACE] is used to create PL units.
Supported SQL statements are CREATE FUNCTION、 CREATE PACKAGE、 CREATE PACKAGE BODY 、CREATE PROCEDURE、CREATE TRIGGER 、 CREATE TYPE and CREATE TYPE BODY.
An optional OR REPLACE clause is specified in each CREATE statement. If the OR REPLACE clause is specified, an existing PL unit can be recreated without being dropped. The original object privileges granted to this unit are also retained. If you redefine a PL unit, the database recompiles it.
Notice
The preceding CREATE statements cannot be specified in a PL block.
ALTER
ALTER is used to recompile a PL unit without recreation (without changing its declaration or definition).
Supported SQL statements are ALTER FUNCTION、 ALTER PACKAGE、ALTER PROCEDURE、ALTER TRIGGER and ALTER TYPE.
You can use the ALTER statement for the following reasons:
Explicitly recompile invalid stored units to avoid implicit recompilation and runtime compilation errors and to reduce performance overhead.
Recompile stored units with different compilation parameters.
Enable or disable a trigger.
DROP
DROP is used to drop an existing PL unit.
Supported SQL statements are DROP FUNCTION、 DROP PACKAGE、DROP PROCEDURE、DROP TRIGGER 、 DROP TYPE and DROP TYPE BODY.