The SA_POLICY_ADMIN.APPLY_TABLE_POLICY procedure adds a specified policy to a table.
If the policy tag column does not exist, it is added to the table and set to NULL, and it will be automatically enabled after the policy is applied. To change the table options, label function, or predicate, you must first remove the policy and then reapply it.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
SA_POLICY_ADMIN.APPLY_TABLE_POLICY (
policy_name IN VARCHAR,
schema_name IN VARCHAR,
table_name IN VARCHAR,
table_options IN VARCHAR := NULL,
label_function IN VARCHAR := NULL,
predicate IN VARCHAR := NULL);
Parameters
| Parameter | Description |
|---|---|
| policy_name | The name of the policy. To find existing policies, query the POLICY_NAME column of the ALL_SA_POLICIES data dictionary view. |
| schema_name | The schema where the table protected by the policy is located. |
| table_name | The table protected by the policy. |
| table_options | A list of policy execution options used by the table, separated by commas. |
| label_function | A string function that returns the label value to be used as the default. |
| predicate | An additional predicate to be combined with label-based predicates using AND or OR. |
Examples
The following statement applies the shield_agent_policy policy to the MISSION_LIST table in the FURY schema.
BEGIN
SA_POLICY_ADMIN.APPLY_TABLE_POLICY(
policy_name => 'shield_agent_policy',
schema_name => 'FURY',
table_name => 'MISSION_LIST');
END;
/
