Schema Object Naming Rules

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 2-20 Oracle Complex Event Processing CQL Language Reference ■ Stream elements in the same stream or view cannot have the same name. However, stream elements in different streams or views can have the same name. ■ Functions can have the same name, if their arguments are not of the same number and datatypes that is, if they have distinct signatures. Creating multiple functions with the same name with different arguments is called overloading the function. If you register or create a user-defined function with the same name and signature as a built-in function, your function replaces that signature of the built-in function. Creating a function with the same name and signature as that of a built-in function is called overriding the function. Built-in functions are public where as user-defined functions belong to a particular schema. For more information, see: ■ Chapter 13, User-Defined Functions

2.9.2 Schema Object Naming Guidelines

Here are several helpful guidelines for naming objects and their parts: ■ Use full, descriptive, pronounceable names or well-known abbreviations. ■ Use consistent naming rules. ■ Use the same name to describe the same entity or attribute across streams, views, and queries. When naming objects, balance the objective of keeping names short and easy to use with the objective of making names as descriptive as possible. When in doubt, choose the more descriptive name, because the objects in Oracle CEP may be used by many people over a period of time. Your counterpart ten years from now may have difficulty understanding a stream element with a name like pmdd instead of payment_due_ date. Using consistent naming rules helps users understand the part that each stream plays in your application. One such rule might be to begin the names of all streams belonging to the FINANCE application with fin_. Use the same names to describe the same things across streams. For example, the department number stream element of the employees and departments streams are both named department_id.

2.9.3 Schema Object Naming Examples

The following examples are valid schema object names: last_name horse hr.hire_date EVEN THIS THAT a_very_long_and_valid_name All of these examples adhere to the rules listed in Section 2.9.1, Schema Object Naming Rules . The following example is not valid, because it exceeds 30 characters: a_very_very_long_and_invalid_name 3 Pseudocolumns 3-1 3 Pseudocolumns A pseudocolumn behaves like a stream element, but is not actually part of the tuple.

3.1 Introduction to Pseudocolumns

You can select from pseudocolumns, but you cannot modify their values. A pseudocolumn is also similar to a function without arguments see Section 1.1.11, Functions . Oracle CQL supports the following pseudocolumns: ■ Section 3.2, ELEMENT_TIME Pseudocolumn

3.2 ELEMENT_TIME Pseudocolumn

Every stream element of a base stream or dervied stream a view that evaluates to a stream has an associated element time.The ELEMENT_TIME pseudo column returns this time as an Oracle CQL native type bigint. This section describes: ■ Section 3.2.1, Understanding the Value of the ELEMENT_TIME Pseudocolumn ■ Section 3.2.2, Using the ELEMENT_TIME Pseudocolumn in Oracle CQL Queries For more information, see: ■ pseudo_column::= on page 7-4 ■ to_timestamp on page 8-20

3.2.1 Understanding the Value of the ELEMENT_TIME Pseudocolumn

The value of the ELEMENT_TIME pseudocolumn depends on whether or not you configure the stream element’s channel as system- or application-timestamped.

3.2.1.1 ELEMENT_TIME for a System-Timestamped Stream

In this case, the element time for a stream element is assigned by the Oracle CEP system in such a way that subtracting two values of system-assigned time will give a duration that roughly matches the elapsed wall clock time. Note: ELEMENT_TIME is not supported on members of an Oracle CQL relation. For more information, see Section 1.1.1, Streams and Relations .