You can use the ALTER TYPE statement to add or drop member attributes or methods.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Note
This statement is not supported.
You can use the ALTER TYPE statement to modify the existing attributes or scalar attributes of an object type. You can also use this statement to recompile the specification or body of a type, or add new object member subprogram specifications to modify the specification of the object type.
You can use the ALTER TYPE statement to perform the following operations on a type created by using the CREATE TYPE or CREATE TYPE BODY statement:
Evolve the type, which is to add or drop member attributes or methods.
Add object member subprogram specifications to modify the specification of the type.
Recompile the specification or body of the type.
Reset the version of the type to 1, so that evolution is no longer considered for the type.
Prerequisites
If a type is in the schema of the SYS user, you must connect to the database with the SYSDBA role. Otherwise, the type must be in your own schema, or you must have the CREATE TYPE or CREATE ANY TYPE system privilege.
Syntax
The syntax of alter_type is as follows:
CREATE TYPE or CREATE ANY TYPE
Specifically:
The syntax of
alter_type_clauseis as follows:{ type_compile_clause | type_replace_clause | RESET | [ NOT ] { INSTANTIABLE | FINAL } | { alter_method_spec | alter_attribute_definition | alter_collection_clauses } [ dependent_handling_clause ] } ;The syntax of
type_compile_clauseis as follows:COMPILE [ DEBUG ] [ SPECIFICATION | BODY ] [ compiler_parameters_clause ]... [ REUSE SETTINGS ]The syntax of
type_replace_clauseis as follows:REPLACE [ invoker_rights_clause [ accessible_by_clause ] | accessible_by_clause | invoker_rights_clause ] ] AS OBJECT ( attribute datatype [, attribute datatype ]... [, element_spec [, element_spec ]... ] )The syntax of
element_specis as follows:[ inheritance_clauses ] { subprogram_spec | constructor_spec | map_order_function_spec }... [, restrict_references_pragma ]The syntax of
inheritance_clausesis as follows:{ [ NOT ] { OVERRIDING | FINAL | INSTANTIABLE } }...The syntax of
subprogram_specis as follows:{ MEMBER | STATIC } { procedure_spec | function_spec }The syntax of
procedure_specis as follows:PROCEDURE procedure_name ( parameter datatype [, parameter datatype ]... ) [ { IS | AS } call_spec ]The syntax of
function_specis as follows:PROCEDURE procedure_name ( parameter datatype [, parameter datatype ]... ) [ { IS | AS } call_spec ]The syntax of
constructor_specis as follows:[ FINAL ] [ INSTANTIABLE ] CONSTRUCTOR FUNCTION datatype [ ([ SELF IN OUT datatype, ] parameter datatype [, parameter datatype ]... ) ] RETURN SELF AS RESULT; [ { IS | AS } call_spec ]The syntax of
map_order_function_specis as follows:{ MAP | ORDER } MEMBER function_specThe syntax of
alter_method_specis as follows:{ ADD | DROP } { map_order_function_spec | subprogram_spec } [, { ADD | DROP } { map_order_function_spec | subprogram_spec } ]...The syntax of
alter_attribute_definitionis as follows:{ { ADD | MODIFY } ATTRIBUTE { attribute [ datatype ] | ( attribute datatype [, attribute datatype ]... ) } | DROP ATTRIBUTE { attribute | ( attribute [, attribute ]... ) } }The syntax of
alter_collections_clausesis as follows:MODIFY { LIMIT integer | ELEMENT TYPE datatype }The syntax of
dependent_handling_clauseis as follows:{ INVALIDATE | CASCADE [ { [ NOT ] INCLUDING TABLE DATA | CONVERT TO SUBSTITUTABLE } ] [ [FORCE ] exceptions_clause ] }The syntax of
exceptions_clauseis as follows:EXCEPTIONS INTO [ schema. ] table