Primitives

When you write in EGL, you will likely use the primitives that are described in this topic.

Not all of the primitives are listed here; for the complete list, see “Primitive data types."

Primitive numeric types

The most common numeric primitives are INT, DECIMAL, and FLOAT.
INT
The basic 4-byte integer is commonly used for internal calculations. You can also use INT for key numbers, stock quantities, or anywhere else that a whole number is appropriate. The range of values you can put in an INT is -2,147,483,648 to +2,147,483,647.
DECIMAL
Use decimals for numbers that need a decimal point; for example, currency amounts or employee hours (if you allow fractions). When you declare a variable of this type, specify the length (in digits, not bytes) and the number of decimal places. If you know that a variable will never need to hold a value as large as ten million dollars, you could declare it as follows:
mySalary DECIMAL(9,2) = 30000.00;
FLOAT
Variables of this type are 8 bytes long (or double-precision, as opposed to single-precision floating point numbers, which are only 4 bytes long). A FLOAT variable stores a number that uses exponents, so it can hold extremely large numbers in those 8 bytes. Very high numbers are the only values that you typically store in FLOAT variables. You can assign the value through ordinary decimal notation, or, because values of FLOAT variables can get so large, through exponential notation, where e indicates a power of ten:
speedOfLight FLOAT = 299800000;
speedOfLight FLOAT = 2.998e8;
Here 2.998e8 means 2.998 x 108.

Primitive character types

The most common character primitives are STRING and CHAR.
STRING
A STRING variable holds a group of characters, such as a name or an address. EGL automatically makes all strings Unicode, which means that each character is 2 bytes long and can handle any international language that the Unicode standard can render. STRING variables, by default, are variable in length. The length of a STRING is the length of the data that it holds, and that length can change at run time. For some uses you might want to limit the size of the STRING variable. To limit the length of the STRING variable, specify a maximum number of characters (not bytes) at declaration time:
myUSState STRING(2) = "TX";
When you assign a STRING value, you place it inside double quotes.
CHAR
The CHAR primitive typically provides compatibility with older programs and data. A variable declared as CHAR(4) would hold 4 bytes of character data.

Primitive date and time types

The most common date and time primitives are DATE, TIME, and TIMESTAMP.
DATE
A DATE variable stores month, day, and year in Gregorian format, using 8 bytes.
TIME
A TIME variable stores hours, minutes, and seconds in 6 bytes.
TIMESTAMP
A TIMESTAMP variable holds both date and time and has a maximum of 20 digits.

For variables that are based on any of these date and time types, you can specify formats for input and output. For more information, see “Date/time masks and format specifiers.”

Primitive large object types

Large object types store unformatted data. EGL passes these types without changing them; generally, EGL either captures and stores them in a database, or retrieves them from a database and transfers them to a program that can display them. There are two types of large-object primitives:
BLOB
You typically use BLOB (binary large object) variables to store visual data, such as JPG files and movies. For example, a Web site that sells movies might store short previews as BLOBs in a database, and serve them to customers on request.
CLOB
You use CLOB (character large object) variables to store character data. For example, a company might use a database to archive e-mails as CLOBs.

Feedback