AntDB-Oracle Compatibility Developer’s Manual P4–2
Published: 2023-09-21 15:52:10

#### identifier

Identifiers are user-defined names that identify the various parts of an SPL program, including variables, cursors, labels, procedures, and parameters.

The syntax rules for valid identifiers in SPL are the same as those in SQL, as discussed in Section 2.1.2 on SQL statement identifiers.

An identifier cannot be defined with the same name as a keyword in the SPL and SQL languages. The following are some examples of properly defined identifiers.

```
x
last___name
a_$_Sign
Many$$$$$$$$signs_____
THIS_IS_AN_EXTREMELY_LONG_NAME
A1
```

#### Qualifiers

A qualifier is a name that specifies the owner of an object or the environment in which the object is used. The object in question is the name of the entity that belongs to the qualifier. Typically, an entity owned by a qualifier is a qualifier followed by a '.' followed by the name of the object owned by the qualifier. It is important to note that the '.' is not preceded or followed by a space.

The following is the syntax for referring to the qualified object

qualifier. \[ qualifier. ]... object

qualifier is the owner of the object. object is the name of the entity that belongs to the qualifier. There is a case where the entity owned by the previous qualifier is identified as a qualifier by the qualifier and object after this entity.

Almost all identifiers can be qualified. Whether or not an identifier can be qualified depends on what the identifier means and the context in which the identifier is used.

The following are some examples of qualifiers.

- Names qualified by the schema to which procedures and functions belong - for example, schema\_name.procedure\_name(...)

- Names qualified by the schema to which the trigger belongs - e.g., schema\_name.trigger\_name

- Column name qualified by the data table to which the column belongs - e.g., emp.empno

- A column name qualified by the data table and schema - e.g., public.emp.empno

A general rule is that wherever a name appears in the syntax of an SPL statement, its qualified name will also be used.

Typically qualified names are used when two procedures with the same name and belonging to two different schemas are called in a program, or when an SPL variable in a program has the same column as a data table, and so on, in cases of identifier naming conflicts.

In practical applications it is recommended that the use of qualifiers should be avoided as much as possible. In this chapter, we can use the following writing conventions to avoid naming conflicts.

- All variables declared in an SPL program begin with the prefix v\_. For example, v\_empno

- Parameters defined in a procedure or function are prefixed with p\_. For example, p\_empno

- Column names and table names do not start with a specific prefix. For example, the column name empno in the data table emp

#### constant

Constants (or direct variables as they are called) can be used in SPL programs to represent values of different data types. For example - numeric values, strings, dates, etc. Constants can generally be of the following types.

- Numeric values (both integer and real)

- Characters and stringsstring

- Dates/Times