The SA_SYSDBA.CREATE_POLICY procedure creates a label security policy, defines a column name specific to the policy, and specifies default policy options.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL 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 policy name, which must be unique within the database. The policy name can contain up to 30 characters in length, but only the first 26 characters are valid. The first 26 characters of policy names of two policies may be different. You can query the POLICY_NAME column of the ALL_SA_POLICIES view for existing policies. |
| column_name | The name of the column to be added to the table that is protected by the policy. If the value is NULL, the name specified for policy_name_COL is used. Two label security policies cannot share the same column name. |
| default_options | The default enforcement options. If you apply a policy without specifying the table or schema to which the policy is applied, the default enforcement options are used. These options include the enforcement options and the option for hiding the label column. The options are separated by commas (,). |
Examples
The following example creates the shield_agent_policy security policy:
BEGIN
SA_SYSDBA.CREATE_POLICY(
policy_name => 'shield_agent_policy',
column_name => 'secret_label');
END;
/