Aliases in the relation_variable Clause

Basic Elements of Oracle CQL 2-15 A AS A.temp = 25, B AS B.temp = 25 and to_timestampB.element_time - to_timestampA.element_ time INTERVAL 0 00:00:05.00 DAY TO SECOND, C AS to_timestampC.element_time - to_timestampA.element_time = INTERVAL 0 00:00:05.00 DAY TO SECOND as its ]]query For more information, see Section 18.2.1.3, From Clause .

2.8.1.2 Aliases in Window Operators

You can use the AS operator to define an alias to label the immediately preceding window operator so that you can reference the result by that name. You may not use the AS operator within a window operator but you may use the AS operator outside of the window operator. Example 2–11 shows how to define aliases bid and ask after partitioned range window operators. Example 2–11 Using the AS Operator After a Window Operator query id=Rule1[CDATA[ SELECT bid.id as correlationId bid.cusip as cusip maxbid.b0 as bid0 bid.srcid as bidSrcId, bid.bq0 as bid0Qty, minask.a0 as ask0, ask.srcid as askSrcId, ask.aq0 as ask0Qty FROM stream1[PARTITION by bid.cusip rows 100 range 4 hours] as bid, stream2[PARTITION by ask.cusip rows 100 range 4 hours] as ask GROUP BY bid.id, bid.cusip, bid.srcid,bid.bq0, ask.srcid, ask.aq0 ]]query For more information, see Section 1.1.3, Stream-to-Relation Operators Windows .

2.8.2 Defining Aliases Using the Aliases Element

Aliases are required to provide location transparency. Using the aliases element, you can define an alias and then use it in an Oracle CQL query or view. You configure the aliases element in the component configuration file of a processor as Figure 2–12 shows. Example 2–12 aliases Element in a Processor Component Configuration File ?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 2-16 Oracle Complex Event Processing CQL Language Reference type-alias sourcestrsource targetjava.lang.String target type-alias aliases processor n1:config The scope of the aliases element is the queries and views defined in the rules element of the processor to which the aliases element belongs. Note the following: ■ If the alias already exists then, Oracle CEP will throw an exception. ■ If a query or view definition references an alias, then the alias must already exist. This section describes: ■ Section 2.8.2.1, How to Define a Data Type Alias Using the Aliases Element

2.8.2.1 How to Define a Data Type Alias Using the Aliases Element

Using the aliases element child element type-alias, you can define an alias for a data type. You can create an alias for any built-in or data cartridge data type. For more information, see Section 2.2, Datatypes . To define a type alias using the aliases element: 1. Edit the component configuration file of a processor. 2. Add an aliases element as Example 2–13 shows. Example 2–13 Adding an aliases Element to a Processor ?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 aliases processor n1:config 3. Add a type-alias child element to the aliases element as Example 2–14 shows. Example 2–14 Adding a type-alias Element to a Processor ?xml version=1.0 encoding=UTF-8? n1:config xmlns:n1=http:www.bea.comnswlevsconfigapplication processor nameprocessor1name rules query id=q1 [CDATA[