Note
This view was introduced in OceanBase Database V4.0.0.
Purpose
The information_schema.VIEW_TABLE_USAGE view displays the information about tables and views used in the view definition.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| VIEW_CATALOG | varchar(64) | NO | The name of the catalog to which the view belongs. |
| VIEW_SCHEMA | varchar(128) | NO | The name of the schema to which the view belongs. |
| VIEW_NAME | varchar(256) | NO | The name of the view. |
| TABLE_SCHEMA | varchar(128) | NO | The name of the schema to which the table or view used in the view definition belongs. |
| TABLE_NAME | varchar(256) | NO | The name of the table or view used in the view definition. |
| TABLE_CATALOG | varchar(64) | NO | The name of the catalog to which the table or view used in the table definition belongs. The value of this column is always def. |
Sample query
Query the information about the tables and views used in the v_test_tbl1 view.
obclient [infotest]> SELECT * FROM information_schema.VIEW_TABLE_USAGE WHERE VIEW_NAME='v_test_tbl1';
The query result is as follows:
+--------------+-------------+-------------+--------------+------------+---------------+
| VIEW_CATALOG | VIEW_SCHEMA | VIEW_NAME | TABLE_SCHEMA | TABLE_NAME | TABLE_CATALOG |
+--------------+-------------+-------------+--------------+------------+---------------+
| def | infotest | v_test_tbl1 | infotest | tbl6 | def |
+--------------+-------------+-------------+--------------+------------+---------------+
1 row in set