PL allows you to create user-defined subtypes SUBTYPE based on basic data types and redefine the user-defined subtypes.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
The syntax for defining SUBTYPE is as follows:
SUBTYPE subtype_name IS base_type
{ precision [, scale ] [ NOT NULL ]
You can redefine the precision of user-defined types or apply the NOT NULL constraint to user-defined types. Here is an example:
obclient> DECLARE
SUBTYPE score IS NUMBER;
amount score(6,2);
SUBTYPE item IS score NOT NULL;
item1 item := 1;
BEGIN
amount := item1;
END;
/