Built-in data types and user-defined data types allow you to define data types that model the structure and behavior of the data in their applications. This topic describes user-defined data types supported by OceanBase Database.
Object types
An object type is an abstraction of a real-world entity, such as a purchase order, that application programs deal with. An object type is a schema object that consists of three kinds of components:
A name, which uniquely identifies the object type within the schema.
Attributes, which are built-in types or other custom types. Attributes model the structure and state of the real-world entity.
Methods, which are functions or procedures written in PL and stored in the database. A method can be used by an application to execute the real-world entity.
Arrays
An array is an ordered set of data elements. All elements of a specified array are of the same data type. Each element has an index, which is a number corresponding to the position of the element in the array.
The number of elements in the array indicates the array size. OceanBase Database allows arrays to be of variable sizes. That is why they are called varrays. You must specify the maximum size of an array when you declare the array.
Declaring an array does not allocate space. It defines a data type that you can use as:
An object type attribute
A PL variable, parameter, or function return type
Nested tables
A nested table is an unordered set of data elements. Both built-in data types and custom data types can be used as elements in a nested table. A nested table has a single column. If the nested table is an object type, you can take it as a multicolumn table, with a column for each attribute of the object type.
A table type definition does not allocate space. It defines a type that you can use as:
An object type attribute
A PL variable, parameter, or function return type
For more information about user-defined data types, see PL reference (Oracle mode).