|Oracle® Database Rules Manager and Expression Filter Developer's Guide
11g Release 1 (11.1)
|PDF · Mobi · ePub|
The Expression Filter and Rules Manager features use schema objects to maintain an Expression column in a user table. Most of these objects are created in the schema of the table with the Expression column. These objects are created with the
EXF$ prefix (Expression Filter) or the
RLM$ prefix (Rules Manager) and are maintained using either the Expression Filter or Rules Manager APIs. You should not modify these objects.
The Expression Filter maintains the concept of an attribute set through an object type with a matching name, while Rules Manager maintains the concept of an event structure through an object type with a matching name. The object type used for an attribute set or event structure may not contain any user methods, and it should not be an evolved type (with the use of the SQL
ALTER TYPE command). If the attribute set or event structure is not created from an existing object type, Expression Filter or Rules Manager creates the object type with the matching name and maintains it throughout the life of the attribute set or event structure. It also generates functions for the object type for data item management, dynamic expression evaluation, and expression type checking.
In addition to the object type, Expression Filter and Rules Manager create a nested table type of the object type in the same schema. This nested table type uses a namespace
n, and it is used internally for the expression validation.
The object type created for the attribute set or event structure can be used to create a table storing the corresponding data items. Such tables could include a column of the object type or the table itself could be created from the object type. These tables can be joined with the table storing expressions. This is shown in the following example using the application example in Chapter 11:
-- a table of type -- CREATE TABLE CarInventory OF Car4Sale; INSERT INTO CarInventory VALUES ('Mustang',2000, 18000, 22000); INSERT INTO CarInventory VALUES ('Mustang',2000, 18000, 22000); INSERT INTO CarInventory VALUES ('Taurus',1997, 14000, 24500); SELECT * FROM Consumer, CarInventory Car WHERE EVALUATE (Consumer.Interest, Car.getVarchar()) = 1; -- table with the object type column -- CREATE TABLE CarStock (CarId NUMBER, Details Car4Sale); INSERT INTO CarStock VALUES (1, Car4Sale('Mustang',2000, 18000, 22000)); INSERT INTO CarStock VALUES (2, Car4Sale('Mustang',2000, 18000, 22000)); INSERT INTO CarStock VALUES (3, Car4Sale('Taurus',1997, 14000, 24500)); SELECT * FROM Consumer, CarStock Car WHERE EVALUATE (Consumer.Interest, Car.Details.getVarchar()) = 1;
Note:You should not modify the object type used to maintain an attribute set or event structure with the SQL
CREATE OR REPLACE
TYPEcommands. System triggers are used to restrict you from modifying these objects.
When an Expression column is created by assigning an attribute set to a
VARCHAR2 column in a user table, a
BEFORE ROW trigger is created on the table. This trigger is used to invoke the expression validation routines when a new expression is added or an existing expression is modified. This trigger is always created in the
EXFSYS schema, and it uses the
The Expression Filter index defined for a column is maintained using database objects created in the schema in which the index is created. These are described in Section 12.8.
Expression Filter uses system triggers to manage the integrity of the system. These include system triggers to:
Restrict the user from dropping an object type created by an attribute set
Drop the attribute set and associated metadata when the user is dropped with a
Maintain the Expression Filter dictionary through
ALTER operations on the table with one or more Expression columns
These triggers are created in the