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 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 have the CREATE TYPE or CREATE ANY TYPE system privilege.
Syntax
Syntax of alter_type:
CREATE TYPE or CREATE ANY TYPE
Where:
Syntax of
alter_type_clause:{ type_compile_clause | type_replace_clause | RESET | [ NOT ] { INSTANTIABLE | FINAL } | { alter_method_spec | alter_attribute_definition | alter_collection_clauses } [ dependent_handling_clause ] } ;Syntax of
type_compile_clause:COMPILE [ DEBUG ] [ SPECIFICATION | BODY ] [ compiler_parameters_clause ]... [ REUSE SETTINGS ]Syntax of
type_replace_clause:REPLACE [ invoker_rights_clause [ accessible_by_clause ] | accessible_by_clause | invoker_rights_clause ] ] AS OBJECT ( attribute datatype [, attribute datatype ]... [, element_spec [, element_spec ]... ] )Syntax of
element_spec:[ inheritance_clauses ] { subprogram_spec | constructor_spec | map_order_function_spec }... [, restrict_references_pragma ]Syntax of
inheritance_clauses:{ [ NOT ] { OVERRIDING | FINAL | INSTANTIABLE } }...Syntax of
subprogram_spec:{ MEMBER | STATIC } { procedure_spec | function_spec }Syntax of
procedure_spec:PROCEDURE procedure_name ( parameter datatype [, parameter datatype ]... ) [ { IS | AS } call_spec ]Syntax of
function_spec:PROCEDURE procedure_name ( parameter datatype [, parameter datatype ]... ) [ { IS | AS } call_spec ]Syntax of
constructor_spec:[ FINAL ] [ INSTANTIABLE ] CONSTRUCTOR FUNCTION datatype [ ([ SELF IN OUT datatype, ] parameter datatype [, parameter datatype ]... ) ] RETURN SELF AS RESULT; [ { IS | AS } call_spec ]Syntax of
map_order_function_spec:{ MAP | ORDER } MEMBER function_specSyntax of
alter_method_spec:{ ADD | DROP } { map_order_function_spec | subprogram_spec } [, { ADD | DROP } { map_order_function_spec | subprogram_spec } ]...Syntax of
alter_attribute_definition:{ { ADD | MODIFY } ATTRIBUTE { attribute [ datatype ] | ( attribute datatype [, attribute datatype ]... ) } | DROP ATTRIBUTE { attribute | ( attribute [, attribute ]... ) } }Syntax of
alter_collections_clauses:MODIFY { LIMIT integer | ELEMENT TYPE datatype }Syntax of
dependent_handling_clause:{ INVALIDATE | CASCADE [ { [ NOT ] INCLUDING TABLE DATA | CONVERT TO SUBSTITUTABLE } ] [ [FORCE ] exceptions_clause ] }Syntax of
exceptions_clause:EXCEPTIONS INTO [ schema. ] table