Basic Elements of Oracle CQL 2-17
select strmsg from cqlInStream [rows 2]; ]]
query rules
aliases
type-alias type-alias
aliases processor
n1:config
4.
Add a source and target child element to the type-alias element as Example 2–15
shows, where:
■
source specifies the alias. You can use any valid schema name. For more information, see
Section 2.9, Schema Object Names and Qualifiers
■
target specifies the data type the alias refers to. For Oracle CQL data cartridge types, use the fully qualified type name. For
more information, see Chapter 14, Introduction to Data Cartridges
.
Example 2–15 Adding the source and target Elements
?xml version=1.0 encoding=UTF-8? n1:config xmlns:n1=http:www.bea.comnswlevsconfigapplication
processor nameprocessor1name
rules query id=q1
[CDATA[ select strmsg from cqlInStream [rows 2];
]] query
rules aliases
type-alias
sourcestrsource targetjava.lang.Stringtarget
type-alias aliases
processor n1:config
5.
Use the alias in the queries and views you define for this processor. You can use the alias in exactly the same way you would use the data type it refers
to. As Example 2–16
shows, you can access methods and fields of the aliased type.
Example 2–16 Accessing the Methods and Fields of an Aliased Type
?xml version=1.0 encoding=UTF-8? n1:config xmlns:n1=http:www.bea.comnswlevsconfigapplication
processor nameprocessor1name
rules query id=q1
[CDATA[
select strmsg.length from cqlInStream [rows 2];
]]
2-18 Oracle Complex Event Processing CQL Language Reference
query rules
aliases type-alias
sourcestrsource targetjava.lang.Stringtarget
type-alias aliases
processor n1:config
2.9 Schema Object Names and Qualifiers
Some schema objects are made up of parts that you can or must name, such as the stream elements in a stream or view, integrity constraints, windows, streams, views,
and user-defined functions. This section provides:
■
Section 2.9.1, Schema Object Naming Rules
■
Section 2.9.2, Schema Object Naming Guidelines
■
Section 2.9.3, Schema Object Naming Examples For more information, see
Section 1.2.1, Lexical Conventions .
2.9.1 Schema Object Naming Rules
Every Oracle CEP object has a name. In a Oracle CQL statement, you represent the name of an object with a quoted identifier or a nonquoted identifier.
■
A quoted identifier begins and ends with double quotation marks . If you name a schema object using a quoted identifier, then you must use the double quotation
marks whenever you refer to that object.
■
A nonquoted identifier is not surrounded by any punctuation. You can use either quoted or nonquoted identifiers to name any Oracle CEP object.
Names are case-sensitive. The following list of rules applies to both quoted and nonquoted identifiers unless
otherwise indicated:
■
Names must be from 1 to 30 characters long. If an identifier includes multiple parts separated by periods, then each attribute
can be up to 30 bytes long. Each period separator, and any surrounding double quotation marks, counts as one byte. For example, suppose you identify a stream
element like this:
stream.attribute The stream name can be 30 bytes and the element name can be 30 bytes. Each of
the quotation marks and periods is a single-byte character, so the total length of the identifier in this example can be up to 65 bytes.
■
Nonquoted identifiers cannot be Oracle CEP reserved words. Quoted identifiers can be reserved words, although this is not recommended.
Depending on the Oracle product you plan to use to access an Oracle CEP object, names might be further restricted by other product-specific reserved words.
Basic Elements of Oracle CQL 2-19
The Oracle CQL language contains other words that have special meanings. These words are not reserved. However, Oracle uses them internally in specific ways.
Therefore, if you use these words as names for objects and object parts, then your Oracle CQL statements may be more difficult to read and may lead to
unpredictable results.
For more information, see
■
identifier::= on page 7-16
■
unreserved_keyword on page 7-17
■
reserved_keyword on page 7-17
■
Oracle recommends that you use ASCII characters in schema object names because ASCII characters provide optimal compatibility across different platforms and
operating systems.
■
Nonquoted identifiers must begin with an alphabetic character from your database character set. Quoted identifiers can begin with any character.
■
Nonquoted identifiers can contain only alphanumeric characters from your Java locale’s character set and the underscore _, dollar sign , and pound sign .
Oracle strongly discourages you from using and in nonquoted identifiers.
Quoted identifiers can contain any characters and punctuations marks and spaces. However, neither quoted nor nonquoted identifiers can contain double quotation
marks or the null character \0.
For more information, see:
■
const_string::= on page 7-12
■
identifier::= on page 7-16
■
In general, you should choose names that are unique across an application for the following objects:
■
Streams
■
Queries
■
Views
■
Windows
■
User-defined functions Specifically, a query and view cannot have the same name.
■
Nonquoted identifiers are not case sensitive. Oracle CEP interprets them as uppercase. Quoted identifiers are case sensitive.
By enclosing names in double quotation marks, you can give the following names to different objects in the same namespace:
employees employees
Employees EMPLOYEES
Note that Oracle CEP interprets the following names the same, so they cannot be used for different objects in the same namespace:
employees EMPLOYEES
EMPLOYEES