Purpose
You can run this statement to query the attribute information of the user-defined types owned by the current user. The USER_TYPE_ATTRS view displays the attributes of user-defined types accessible to the current user.
Applicability
This view applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TYPE_NAME | VARCHAR2(64) | NO | The name of the type. |
| ATTR_NAME | VARCHAR2(64) | NO | The name of the attribute. |
| ATTR_TYPE_MOD | VARCHAR2(7) | NO | At present, this column is not used. |
| ATTR_TYPE_OWNER | VARCHAR2(128) | NO | The owner of the attribute type. |
| ATTR_TYPE_NAME | VARCHAR2(324) | NO | Name of the attribute data type |
| LENGTH | NUMBER(38) | NO | The length of the attribute type. |
| NUMBER_PRECISION | NUMBER(38) | NO | The decimal precision of the number attribute. |
| SCALE | NUMBER(38) | NO | The number of digits on the right of the decimal point in a number. |
| CHARACTER_SET_NAME | CHAR(7) | NO | The name of the character set for the attribute type. Valid values: CHAR_CS and NCHAR_CS. |
| ATTR_NO | NUMBER(38) | NO | The serial number of the attribute. |
| INHERITED | CHAR(2) | NO | Indicates whether the attribute is inherited from a supertype. |
| CHAR_USED | CHAR(1) | YES | Indicates whether the attribute is defined in terms of byte length (B) or character length (C). |
Sample query
Query the attribute information of a user-defined type.
obclient [SYS]> SELECT * FROM SYS.USER_TYPE_ATTRS;
The query result is as follows:
+-------------+--------------+---------------+-----------------+----------------+--------+------------------+-------+--------------------+---------+-----------+-----------+
| TYPE_NAME | ATTR_NAME | ATTR_TYPE_MOD | ATTR_TYPE_OWNER | ATTR_TYPE_NAME | LENGTH | NUMBER_PRECISION | SCALE | CHARACTER_SET_NAME | ATTR_NO | INHERITED | CHAR_USED |
+-------------+--------------+---------------+-----------------+----------------+--------+------------------+-------+--------------------+---------+-----------+-----------+
| PROJECT_OBJ | PROJECT_NAME | NULL | NULL | VARCHAR2 | 100 | 2 | -1 | CHAR_CS | 1 | NO | C |
| PROJECT_OBJ | STATUS | NULL | NULL | VARCHAR2 | 20 | 2 | -1 | CHAR_CS | 2 | NO | C |
+-------------+--------------+---------------+-----------------+----------------+--------+------------------+-------+--------------------+---------+-----------+-----------+
2 rows in set
Related views or documents
View the attribute information of all user-defined types in the current schema: DBA_TYPE_ATTRS
View the attributes of all custom types that can be accessed by the current user: ALL_TYPE_ATTRS