The SA_POLICY_ADMIN.APPLY_TABLE_POLICY procedure adds the specified policy to a table.
If a policy label column does not exist, it is added to the table and set to NULL. A policy is automatically enabled after it is applied. If you need to change the table options, labeling 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 provides only MySQL mode.
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 policy name. You can query the POLICY_NAME column of the ALL_SA_POLICIES data dictionary view for existing policies. |
| schema_name | The schema containing the table protected by the policy. |
| table_name | The table protected by the policy. |
| table_options | A list of comma-delimited policy enforcement options used by the table. |
| label_function | A string invoking a function to return the label value that is used as the default value. |
| predicate | An additional predicate. It is combined with the label-based predicate by using AND or OR. |
Examples
The following example applies shield_agent_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;
/