link rel="Copyright" href="../../dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> < link rel="Next" href="packages.htm" title="Next" type="text/html" />
| Oracle® Database Application Developer's Guide - Expression Filter 10g Release 1 (10.1) Part Number B10821-01 |
|
![]() Previous |
![]() Next |
The Expression Filter feature is supplied with a set of predefined types and public synonyms for these types.
Most of these types are used for configuring index parameters with the Expression Filter procedural APIs. The EXF$TABLE_ALIAS
code> type is used to support expressions defined on one or more database tables.
All the values and names passed to the types defined in this chapter are not case sensitive. To preserve the case, you use double quotation marks around the values.
The
Attributes
| Name | Datatype | Description |
|---|---|---|
attr_name |
VARCHAR2(350) |
The arithmetic expression that constitutes the st ored or indexed attribute. |
attr_oper
code> |
EXF$INDEXOPER |
The
list of common operators in the predicates with the attribute. Default value: EXF$INDEXOPER('all') |
attr_indexed |
VARCHAR2(5) |
TRUE if the attribute is indexed, else
FALSE. Default value: FALSE. |
Usage Notes
The EXF$ATTRIBUTE type is used to specify the stored and indexed attributes for an Expression Filter index using th
e DBMS_EXPFIL.DEFAULT_INDEX_PARAMETERS procedure. When values for attr_oper and attr_indexed fields are omi
tted during EXF$ATTRIBUTE instantiation, it is considered a stored attribute with a default value for common operators (
EXF$INDEXOPER('all')).
Examples
A stored attribute with no preference on the list of common operators is represented as follows:
exf$attribute (attr_name => 'HorsePower(Model, Year)')
An indexed attribute is represented as follows:
exf$attribute (attr_name => 'HorsePower(Model, Year)',
a
ttr_indexed => 'TRUE')
An indexed attribute with a list of common operators is represented as follows:
exf$attribute (attr_name => 'HorsePower(Model, Year)',
attr_oper => exf$indexoper('=','<','&g
t;','>=','<='),
attr_indexed => 'TRUE')
The EXF$ATTRIBUTE
_LIST type is defined as follows:
CREATE or REPLACE TYPE exf$attribute_list as VARRAY(490) of exf$attribute;
Attributes
None.
Usage Notes
The EXF$ATTRIBUTE_LIST type is used to specify a list of stored
and indexed attributes while configuring the index parameters. (Also see the "DEFAULT_INDEX_PARAMETER
S Procedure" in Chapter 8 for more information.)
Examples
A list of stored and indexed at tributes can be represented as follows:
exf$attribute_list (
exf$attribute (attr_name => 'Mod
el',
attr_oper => exf$indexoper('='),
attr_indexed => 'TRUE'),
exf$attribute (attr_name => 'Price',
attr_oper => exf$indexoper('all'),
a
ttr_indexed => 'TRUE'),
exf$attribute (attr_name => 'HorsePower(Model, Year)',
attr_oper => e
xf$indexoper('=','<','>','>=','<='),
attr_indexed => 'FALSE')
)
The EXF$INDEXOPER type is used to specify the list of commo
n operators in predicates with a stored or an indexed attribute.
The EXF$INDEXOPER type is defined as follows:
CREATE or REPLACE TYPE exfsys.exf$indexoper as VARRAY(20) of VARCHAR2(15);
The values for the
EXF$INDEXOPER array are expected to be from the list in the following table:
| Value | Predicate Description |
|---|---|
| = |
Equality predicates |
| > |
Greater than predicates |
| < |
Less than predicates |
| >= |
Greater than or equal to predi cates |
| <= |
Less than or equal to predicates |
| != or <> or ^= | Not equal to predicates |
IS NULL |
|
IS NOT NUL
L |
IS NOT NULL predicates |
ALL |
All the operators
listed in this table starting with the equality predicate through the IS NOT NULL predicate |
NVL |
Pred
icates with NVL (equality) operator |
LIKE |
Predicates with LIKE operator |
BETWEEN |
BETWEEN predicates |
Attributes
None.
Usage Notes
A value of ALL for one of the EXF$INDEXOPER items implies that all the simple operators (=,>
,<,>=,<=,!=, IS NULL, IS NOT NULL) are common in the predicates with an attribute. This value can
be used along with one or more complex operators (NVL, LIKE and BETWEEN).
A predicate w
ith a BETWEEN operator is treated as two predicates with binary operators, one with '>=' operator and another with '&
lt;=' operator. By default, only one of these operators is indexed, and the other operator is evaluated by value substitution. Howeve
r, if predicates with the BETWEEN operator are common for an attribute (stored or indexed), both the binary operators re
sulting from the BETWEEN operator can be indexed by specifying BETWEEN in the EXF$INDEXOPER VARRAY. However, because this uses additional space in the predicate table, this operator should be used only when majority of predicat
es with an attribute use the BETWEEN operator.
When the LIKE operator is chosen as one of the common
operators for an attribute, LIKE predicates on that attributes are indexed. Indexing a LIKE operator is be
neficial only if the VARCHAR2 constant on the right-hand side of the predicate does not lead with a wild-card character.
For example, indexing a LIKE operator will filter the following predicates efficiently:
c ompany LIKE 'General%' company LIKE 'Proctor%'
But, the following predicates are evaluated as sparse predicates in the la st stage:
company LIKE '%Electric' company LIKE "%Gamble'a>
Examples
An attribute with a list of c ommon operators is represented as follows:
exf$attribute (attr_name => 'HorsePower(Model, Year)',
attr_oper => exf$indexoper('=','<','>','>=','<=', 'between'),
attr_indexed => 'TRUE')
A table alias is a special form of elementary attribute that can be included in the attrib ute set. These attributes are used to manage expressions defined on one or more database tables.
Attributes
| Datatype | Description | table_name |
VARCHAR2(70) |
Name of the table with a possible schema ex tension. |
|---|
The concept of a table alias attribute is
captured in the Expression Filter dictionary and the corresponding attribute in the attribute set's object type is created with a
Examples
For a set of expressions defined on databa se tables, the corresponding table alias attributes are configured as follows:
BEGIN
DBMS_EXPFIL.ADD_
ELEMENTARY_ATTRIBUTE (
attr_set => 'HRAttrSet',
attr_name => 'EM
P',
tab_alias => exf$table_alias('SCOTT.EMP'));
DBMS_EXPFIL.ADD_ELEMENTARY_ATTRIBUTE (
attr_set => 'HRAttrSet',
attr_name => 'DEPT',
tab_alias => exf$table_alias('DEPT'));
END;
/
The Expression column using the previous attribute set can store expr
essions of form EMP.JOB = 'Clerk' and EMP.NAME = 'Joe', where JOB and NAME are the names of th
e columns in the SCOTT.EMP table.
The EXF$XPATH_TAG type is used to con
figure an XML element or an XML attribute for indexing a set of XPath predicates.
| Name | Datatype | Description |
|---|---|---|
tag_name |
VARCHAR2(70) |
Name of the XML element or attribute. The name for an XML attrib
ute is formatted as: <ElementName>@<AttributeName>. |
tag_indexed |
VARCHAR2(5)
| TRUE if XML tag is indexed; otherwise FALSE.
Default:
|
tag_type |
VARCHAR2(30) |
Datatype for the value in the case of value filte
r. NULL for positional filters. |
Usage Notes
EXF$XPATH_TAG type is used to configure an XML element or an attribute as a positional or a value filter for an Expression Fil
ter index (see Chapter 3). An instance of the EXF$XPATH_TAG type with N
ULL value for tag_type configures the XML tag as a positional filter. In the current release, the only other poss
ible values for the tag_type attribute are strings (CHAR or VARCHAR) and such tags are configu
red as value filters. By default, all positional filters are indexed and the value filters are not indexed. This behavior can be over
ridden by setting a TRUE or FALSE value for the tag_indexed attribute accordingly.
Examples
< p>An XML element can be configured as a positional filter and be indexed using the following instance of theEXF$XPATH_TAG type.
exf$xpath_tag(tag_name => 'stereo', --- XML element
tag_indexed =>
; 'TRUE', --- indexed predicate group
tag_type => null) --- positional filter
An XML
attribute can be configured as a value filter and be indexed using the following type instance.
exf$xp
ath_tag(tag_name => 'stereo@make', --- XML attribute
tag_indexed => 'TRUE', --- indexed predicate gro
up
tag_type => 'VARCHAR(15)') --- value filter
A type used to specify a list of XML tags while configuring the Expression Filter index parameters. This type is defined as follows:
CREATE or REPLACE TYPE exf$xpath_tags as VARRAY(490) of exf$xpath_tag;
None.
Usage Notes
EXF$XPATH_
TAGS type is used to specify a list of XML tags while configuring the Expression Filter index parameters. (See "DEFAULT_XPINDEX_PARAMETERS Procedure" in Chapter 8.)
Examples
A list of XML tags configured as positional and value filters can be represented as follows:
exf$xpath_tags(
exf$xpath_tag(tag_name => 'stereo@make', --- XML attribute
tag_indexed => 'TRUE',
tag_type => 'VARCHAR(15)'), --- value filter
exf$xpath_tag(tag_name => 'stereo', --- XM
L element
tag_indexed => 'FALSE',
tag_type => null), --- position
al filter
exf$xpath_tag(tag_name => 'memory', --- XML element
tag_indexed => 'TRUE
',
tag_type => 'VARCHAR(10)') --- value filter
)