Note
This view is available starting with V4.1.0.
Purpose
This view records the rules for rewriting SQL statements in the current tenant.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| DB_NAME | varchar(128) | NO | The DB_NAME specified when the rule was defined. |
| RULE_NAME | varchar(256) | NO | The name of the rule. |
| RULE_ID | bigint(20) | NO | The ID of the rule. |
| PATTERN | longtext | NO | The template of the statement that matches the rule. |
| REPLACEMENT | longtext | NO | The template that indicates how to rewrite statements that match the pattern. |
| NORMALIZED_PATTERN | longtext | NO | The parameterized pattern. |
| STATUS | varchar(10) | NO |
|
| VERSION | bigint(20) | NO | The version number of the rule. |
| PATTERN_DIGEST | bigint(20) unsigned | NO | The hash value of the NORMALIZED_PATTERN. |
Sample query
Query the rules for rewriting SQL statements in the current tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_USER_DEFINED_RULES;
The query result is as follows:
+---------+-----------+---------+--------------------+------------------------+--------------------+--------+---------+---------------------+
| DB_NAME | RULE_NAME | RULE_ID | PATTERN | REPLACEMENT | NORMALIZED_PATTERN | STATUS | VERSION | PATTERN_DIGEST |
+---------+-----------+---------+--------------------+------------------------+--------------------+--------+---------+---------------------+
| test | rule1 | 500019 | select ? from dual | select ? + 1 from dual | select ? from dual | ENABLE | 3 | 2647993221679348756 |
+---------+-----------+---------+--------------------+------------------------+--------------------+--------+---------+---------------------+
2 rows in set
