Floating-Point Literals Numeric Literals

2-10 Oracle Complex Event Processing CQL Language Reference For example, if your Java locale specifies a decimal character of comma ,, specify the number 5.123 as follows: 5,123 Here are some valid NUMBER literals: 25 +6.34 0.5 -1 Here are some valid floating-point number literals: 25f +6.34F 0.5d -1D

2.4.3 Datetime Literals

Oracle CEP supports datetime datatype TIMESTAMP. Datetime literals must not exceed 64 bytes. All datetime literals must conform to one of the java.text.SimpleDateFormat format models that Oracle CQL supports. For more information, see Section 2.5.2, Datetime Format Models . Currently, the SimpleDateFormat class does not support xsd:dateTime. As a result, Oracle CQL does not support XML elements or attributes that use this type. For example, if your XML event uses an XSD like Example 2–6 , Oracle CQL cannot parse the MyTimestamp element. Example 2–6 Invalid Event XSD: xsd:dateTime is Not Supported xsd:element name=ComplexTypeBody xsd:complexType xsd:sequence xsd:element name=MyTimestamp type=xsd:dateTime xsd:element name=ElementKind type=xsd:string xsd:element name=name type=xsd:string xsd:element name=node type=SimpleType xsd:sequence xsd:complexType xsd:element Oracle recommends that you define your XSD to replace xsd:dateTime with xsd:string as Example 2–7 shows. Example 2–7 Valid Event XSD: Using xsd:string Instead of xsd:dateTime xsd:element name=ComplexTypeBody xsd:complexType xsd:sequence xsd:element name=MyTimestamp type=xsd:string xsd:element name=ElementKind type=xsd:string xsd:element name=name type=xsd:string xsd:element name=node type=SimpleType xsd:sequence xsd:complexType xsd:element Basic Elements of Oracle CQL 2-11 Using the XSD from Example 2–7 , Oracle CQL can process events such as that shown in Example 2–8 as long as the Timestamp element’s String value conforms to the java.text.SimpleDateFormat format models that Oracle CQL supports. For more information, see Section 2.5.2, Datetime Format Models . Example 2–8 XML Event Payload ComplexTypeBody xmlns:xsi=http:www.w3.org2001XMLSchema-instance ... MyTimestamp2000-01-15T00:00:00MyTimestamp ElementKindplusElementKind namecomplexEventname node typecomplexNodetype number1number node ComplexTypeBody For more information on using XML with Oracle CQL, see SQLXML SQLX on page 5-16.

2.4.4 Interval Literals

An interval literal specifies a period of time. Oracle CEP supports interval literal DAY TO SECOND. This literal contains a leading field and may contain a trailing field. The leading field defines the basic unit of date or time being measured. The trailing field defines the smallest increment of the basic unit being considered. Part ranges such as only SECOND or MINUTE to SECOND are not supported. Interval literals must not exceed 64 bytes.

2.4.4.1 INTERVAL DAY TO SECOND

Specify DAY TO SECOND interval literals using the following syntax: interval_value::= where const_string is a TIMESTAMP value that conforms to the appropriate datetime format model see Section 2.5.2, Datetime Format Models . Examples of the various forms of INTERVAL DAY TO SECOND literals follow: You can add or subtract one DAY TO SECOND interval literal from another DAY TO SECOND literal and compare one interval literal to another as Example 2–9 shows. In this example, stream tkdata2_SIn1 has schema c1 integer, c2 interval. Example 2–9 Comparing Intervals query id=tkdata2_q295[CDATA select from tkdata2_SIn1 where c2 + INTERVAL 2 1:03:45.10 DAY TO SECOND INTERVAL 6 12:23:45.10 DAY TO SECOND ]]query Form of Interval Literal Interpretation INTERVAL 4 5:12:10.222 DAY TO SECOND3 4 days, 5 hours, 12 minutes, 10 seconds, and 222 thousandths of a second.