You declare a record part of type sqlRecord in an EGL file, which is described in EGL source format. For an overview of how EGL interacts with relational databases, see SQL support.
An example of a SQL record part is as follows:
Record mySQLRecordPart type sqlRecord { tableNames = (mySQLTable T1), keyItems = myHostVar01, defaultSelectCondition = #sql{ // no space between #sql and the brace hostVar02 = 4 -- start each SQL comment -- with a double hypen } } // The structure of an SQL record has no hierarchy 10 myHostVar01 myDataItemPart01 { column = column01, isNullable = no, isReadOnly = no }; 10 myHostVar02 myDataItemPart02 { column = column02, isNullable = yes, isReadOnly = no }; end
The syntax diagram for an SQL record part is as follows:
You may include a double quote mark (") in a table name by preceding the quote mark with the escape character (\). That convention is necessary, for example, when a table name is one of these SQL reserved words:
Each of those names must be embedded in a doubled pair of quote marks. If the only table name is SELECT, for example, the tableNames clause is as follows:
tableNames=("\"SELECT\"")
(A similar situation applies when one of those SQL reserved words is used as a column name.)
Lists one or more table-name variables, each of which contains the name of a table that is accessed by the SQL record. The name of a table is determined only at run time.
The variable may be qualified by a library name and may be subscripted.
If you specify a label for a given table-name variable, the label is included in the default SQL statements that are associated with the record.
You may use table-name variables alone or with table names; but the use of any table-name variable ensures that the characteristics of your SQL statement will be determined only at run time.
You may include a double quote mark (") in a table-name variable by preceding the quote mark with the escape character (\).
EGL provides an implicit SQL statement with a WHERE clause when you code one of these EGL statements:
The implicit SQL statements are not stored in the EGL source code. For an overview of those statements, see SQL support.
Related concepts
EGL projects, packages, and files
Overview of EGL properties and overrides
Parts
References to parts
Record parts
SQL support
Typedef
Related tasks
Syntax diagram
Related reference
Arrays
DataItem part in EGL source format
EGL source format
Function part in EGL source format
Indexed record part in EGL source format
MQ record part in EGL source format
Naming conventions
Primitive types
Program part in EGL source format
References to variables and constants
Relative record part in EGL source format
Serial record part in EGL source format
SQL item properties
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.