Variable Declaration

 

Variables of any data type or declared LIKE a table column are defined using the following pattern:

 

 

Element

Description

Identifier

The name of the declared variable

Column Id

A name of a database column in the format table.column. It can also be preceded by other table qualifiers: as table owner, server name and database

4GL Data Type

Any 4GL data type or user defined data type or a table column preceded by the LIKE keyword

 

Here are the examples of data types declaration:

 

DEFINE var1 INTEGER

 

 

DEFINE var3 my_datatype

 

The OF keyword is optional, it can be used to specify both 4GL and user-defined data types. Its presence or absence does not influence the result of declaration. The examples below will have the same effect as the examples above.

 

DEFINE var1 OF INTEGER

DEFINE var3 OF my_datatype

 

You can define a variable of the following Querix 4GL data types:

 

The simple and large data types are declared by putting the name of the data type after the variable name as shown below:

 

DEFINE

      var1 CHAR(20),

      var2 INT,

      var3 BYTE

 

Those data types that have size or precision can have them in the parentheses following the name of the data type directly (e.g. CHAR(20) ). The declaration of structured data types is performed in accordance with declaration patterns illustrated below.