PL/SQL Packages and Types Reference 10g Release 1 (10.1) Part Number B10802-01 |
|
|
View PDF |
The DBMS_RULE_ADM
package provides the administrative interfaces for creating and managing rules, rule sets, and rule evaluation contexts.
See Also:
|
This chapter contains the following topics:
PUBLIC
is granted execute privilege on this package.
This procedure adds the specified rule to the specified rule set.
DBMS_RULE_ADM.ADD_RULE( rule_name IN VARCHAR2, rule_set_name IN VARCHAR2, evaluation_context IN VARCHAR2 DEFAULT NULL, rule_comment IN VARCHAR2 DEFAULT NULL);
To run this procedure, a user must meet at least one of the following requirements:
ALTER_ON_RULE_SET
privilege on the rule setALTER
_ANY
_RULE
_SET
system privilegeAlso, the rule set owner must meet at least one of the following requirements:
If the rule has no evaluation context and no evaluation context is specified when you run this procedure, then rule uses the evaluation context associated with the rule set. In such a case, the rule owner must have the necessary privileges on all the base objects accessed by the rule using the evaluation context.
If an evaluation context is specified, then the rule set owner must meet at least one of the following requirements:
EXECUTE_ON_EVALUATION_CONTEXT
privilege on the evaluation contextEXECUTE_ANY_EVALUATION_CONTEXT
system privilege, and the owner of the evaluation context must not be SYS
Also, the rule owner must have the necessary privileges on all the base objects accessed by the rule using the evaluation context.
This procedure changes one or more aspects of the specified rule.
DBMS_RULE_ADM.ALTER_RULE( rule_name IN VARCHAR2, condition IN VARCHAR2 DEFAULT NULL, evaluation_context IN VARCHAR2 DEFAULT NULL, remove_evaluation_context IN BOOLEAN DEFAULT false, action_context IN SYS.RE$NV_LIST DEFAULT NULL, remove_action_context IN BOOLEAN DEFAULT false, rule_comment IN VARCHAR2 DEFAULT NULL, remove_rule_comment IN BOOLEAN DEFAULT false);
To run this procedure, a user must meet at least one of the following requirements:
ALTER_ON_RULE
privilege on the ruleALTER
_ANY
_RULE
system privilegeIf an evaluation context is specified, then the rule owner must meet at least one of the following requirements:
EXECUTE_ON_EVALUATION_CONTEXT
privilege on the evaluation contextEXECUTE_ANY_EVALUATION_CONTEXT
system privilege, and the owner of the evaluation context must not be SYS
Also, the rule owner must have the necessary privileges on all the base objects accessed by the rule using the evaluation context.
See Also:
Chapter 181, "Rule TYPEs" for more information about the types used with the |
This procedure creates a rule evaluation context. A rule evaluation context defines external data that can be referenced in rule conditions. The external data can either exist as variables or as table data.
DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT( evaluation_context_name IN VARCHAR2, table_aliases IN SYS.RE$TABLE_ALIAS_LIST DEFAULT NULL, variable_types IN SYS.RE$VARIABLE_TYPE_LIST DEFAULT NULL, evaluation_function IN VARCHAR2 DEFAULT NULL, evaluation_context_comment IN VARCHAR2 DEFAULT NULL);
Parameter | Description |
---|---|
|
The name of the evaluation context you are creating, specified as For example, to create an evaluation context named |
|
Table aliases that specify the tables in an evaluation context. The table aliases can be used to reference tables in rule conditions. |
|
A list of variables for the evaluation context |
|
An optional function that will be called to evaluate rules using the evaluation context. It must have the same form as the See "Usage Notes" for more information about the evaluation function. |
|
An optional description of the rule evaluation context. |
To run this procedure, a user must meet at least one of the following requirements:
CREATE_EVALUATION_CONTEXT_OBJ
system privilegeCREATE
_ANY
_EVALUATION
_CONTEXT
system privilege
See Also:
Chapter 181, "Rule TYPEs" for more information about the types used with the |
The evaluation function must have the following signature:
FUNCTION evaluation_function_name( rule_set_name IN VARCHAR2, evaluation_context IN VARCHAR2, event_context IN SYS.RE$NV_LIST DEFAULT NULL, table_values IN SYS.RE$TABLE_VALUE_LIST DEFAULT NULL, column_values IN SYS.RE$COLUMN_VALUE_LIST DEFAULT NULL, variable_values IN SYS.RE$VARIABLE_VALUE_LIST DEFAULT NULL, attribute_values IN SYS.RE$ATTRIBUTE_VALUE_LIST DEFAULT NULL, stop_on_first_hit IN BOOLEAN DEFAULT false, simple_rules_only IN BOOLEAN DEFAULT false, true_rules OUT SYS.RE$RULE_HIT_LIST, maybe_rules OUT SYS.RE$RULE_HIT_LIST); RETURN BINARY_INTEGER;
Note: Each parameter is required and must have the specified datatype. However, you can change the names of the parameters. |
The return value of the function must be one of the following:
DBMS_RULE_ADM.EVALUATION_SUCCESS
: The user specified evaluation function completed the rule set evaluation successfully. The rules engine returns the results of the evaluation obtained by the evaluation function to the rules engine client using the DBMS_RULE.EVALUATE
procedure.DBMS_RULE_ADM.EVALUATION_CONTINUE
: The rules engine evaluates the rule set as if there were no evaluation function. The evaluation function is not used, and any results returned by the evaluation function are ignored.DBMS_RULE_ADM.EVALUATION_FAILURE
: The user specified evaluation function failed. Rule set evaluation stops, and an error is raised.This procedure creates a rule.
DBMS_RULE_ADM.CREATE_RULE( rule_name IN VARCHAR2, condition IN VARCHAR2, evaluation_context IN VARCHAR2 DEFAULT NULL, action_context IN SYS.RE$NV_LIST DEFAULT NULL, rule_comment IN VARCHAR2 DEFAULT NULL);
To run this procedure, a user must meet at least one of the following requirements:
CREATE_RULE_OBJ
system privilegeCREATE
_ANY
_RULE
system privilegeIf an evaluation context is specified, then the rule owner must meet at least one of the following requirements:
EXECUTE_ON_EVALUATION_CONTEXT
privilege on the evaluation contextEXECUTE_ANY_EVALUATION_CONTEXT
system privilege, and the owner of the evaluation context must not be SYS
.Also, the rule owner must have the necessary privileges on all the base objects accessed by the rule using the evaluation context.
See Also:
Chapter 181, "Rule TYPEs" for more information about the types used with the |
This procedure creates a rule set.
DBMS_RULE_ADM.CREATE_RULE_SET( rule_set_name IN VARCHAR2, evaluation_context IN VARCHAR2 DEFAULT NULL, rule_set_comment IN VARCHAR2 DEFAULT NULL);
To run this procedure, a user must meet at least one of the following requirements:
CREATE_RULE_SET_OBJ
system privilegeCREATE
_ANY
_RULE
_SET
system privilegeIf an evaluation context is specified, then the rule set owner must meet at least one of the following requirements:
EXECUTE_ON_EVALUATION_CONTEXT
privilege on the evaluation contextEXECUTE_ANY_EVALUATION_CONTEXT
system privilege, and the owner of the evaluation context must not be SYS
This procedure drops a rule evaluation context.
DBMS_RULE_ADM.DROP_EVALUATION_CONTEXT( evaluation_context_name IN VARCHAR2, force IN BOOLEAN DEFAULT false);
To run this procedure, a user must meet at least one of the following requirements:
This procedure drops a rule.
DBMS_RULE_ADM.DROP_RULE( rule_name IN VARCHAR2, force IN BOOLEAN DEFAULT false);
To run this procedure, a user must meet at least one of the following requirements:
This procedure drops a rule set.
DBMS_RULE_ADM.DROP_RULE_SET( rule_set_name IN VARCHAR2, delete_rules IN BOOLEAN DEFAULT false);
To run this procedure, a user must meet at least one of the following requirements:
This procedure grants the specified object privilege on the specified object to the specified user or role. If a user owns the object, then the user automatically is granted all privileges on the object, with grant option.
DBMS_RULE_ADM.GRANT_OBJECT_PRIVILEGE( privilege IN BINARY_INTEGER, object_name IN VARCHAR2, grantee IN VARCHAR2, grant_option IN BOOLEAN DEFAULT false);
Parameter | Description |
---|---|
|
The name of the object privilege to grant to the grantee on the object. See "Usage Notes" for the available object privileges. |
|
The name of the object for which you are granting the privilege to the grantee, specified as |
|
The name of the user or role for which the privilege is granted. The specified user cannot be the owner of the object. |
|
If If |
To run this procedure, a user must meet at least one of the following requirements:
In addition, if the object is a rule set, then the user must have EXECUTE
privilege on all the rules in the rule set with grant option or must own the rules in the rule set.
Table 82-11 lists the object privileges.
For example, to grant the HR
user the privilege to alter a rule named hr_dml
in the strmadmin
schema, enter the following:
BEGIN DBMS_RULE_ADM.GRANT_OBJECT_PRIVILEGE( privilege => SYS.DBMS_RULE_ADM.ALTER_ON_RULE, object_name => 'strmadmin.hr_dml', grantee => 'hr', grant_option => false); END; /
This procedure grant the specified system privilege to the specified user or role.
DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( privilege IN BINARY_INTEGER, grantee IN VARCHAR2, grant_option IN BOOLEAN DEFAULT false);
Table 82-13 lists the system privileges.
For example, to grant the strmadmin
user the privilege to create a rule set in any schema, enter the following:
BEGIN DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE( privilege => SYS.DBMS_RULE_ADM.CREATE_ANY_RULE_SET, grantee => 'strmadmin', grant_option => false); END; /
This procedure removes the specified rule from the specified rule set.
DBMS_RULE_ADM.REMOVE_RULE( rule_name IN VARCHAR2, rule_set_name IN VARCHAR2, evaluation_context IN VARCHAR2 DEFAULT NULL, all_evaluation_contexts IN BOOLEAN DEFAULT false);
To run this procedure, a user must meet at least one of the following requirements:
ALTER_ON_RULE_SET
privilege on the rule setALTER
_ANY
_RULE
_SET
system privilegeThis procedure revokes the specified object privilege on the specified object from the specified user or role.
DBMS_RULE_ADM.REVOKE_OBJECT_PRIVILEGE( privilege IN BINARY_INTEGER, object_name IN VARCHAR2, revokee IN VARCHAR2);
Parameter | Description |
---|---|
|
The name of the object privilege on the object to revoke from the revokee. See "GRANT_OBJECT_PRIVILEGE Procedure" for a list of the object privileges. |
|
The name of the object for which you are revoking the privilege from the revokee, specified as |
|
The name of the user or role from which the privilege is revoked. The user who owns the object cannot be specified. |
Revokes the specified system privilege from the specified user or role.
DBMS_RULE_ADM.REVOKE_SYSTEM_PRIVILEGE( privilege IN BINARY_INTEGER, revokee IN VARCHAR2);
Parameter | Description |
---|---|
|
The name of the system privilege to revoke from the revokee. See "GRANT_SYSTEM_PRIVILEGE Procedure" for a list of the system privileges. |
|
The name of the user or role from which the privilege is revoked |