The SA_SYSDBA.CREATE_POLICY procedure creates a new label security policy, defines the column names for the specific policy, and specifies the default policy options.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL-compatible mode.
Syntax
SA_SYSDBA.CREATE_POLICY (
policy_name IN VARCHAR,
column_name IN VARCHAR := NULL,
default_options IN VARCHAR := NULL
);
Parameters
| Parameter | Description |
|---|---|
| policy_name | The name of the policy, which must be unique in the database. The policy name can be up to 30 characters long, but only the first 26 characters are valid. Two policies can have different names for the first 26 characters. To find the list of existing policies, query the POLICY_NAME column of the ALL_SA_POLICIES view. |
| column_name | The name of the column to be added to the table protected by the policy. If NULL, policy_name_COL is used. Two label security policies cannot share the same column name. |
| default_options | The default enforcement options. When a policy is applied but the table or schema to which it is applied is not specified, the default enforcement options (including the enforcement option and the option to hide the label column) are used. Separate each option with a comma. |
Examples
The following example creates a security policy named shield_agent_policy.
BEGIN
SA_SYSDBA.CREATE_POLICY (
policy_name => 'shield_agent_policy',
column_name => 'secret_label');
END;
/