Was this helpful?
Using Literals in Expressions
The following literals are valid expressions:
'J. J. Jones'
'Hendersonville'
'17-Aug-1998 10:00'
1209
7.77
4GL recognizes two basic types of literals, string and numeric. In addition, it recognizes the special literal NULL.
String literals include character strings, date, and hexadecimal strings.
Character literals are represented by a sequence of characters enclosed in single quotation marks. Within a string literal, you can indicate a literal single quote by typing two single quotes (for example, 'J. J. Jones''s').
Application constants are represented by the constant name preceded by a colon (for example, :help_opt).
Date literals must be specified as strings (for example, '11/15/98') but you can manipulate dates in date arithmetic operations.
Hexadecimal numbers are represented by a special form of string literal. This is a string of hexadecimal digits (0 through 9 and A through F) preceded by the letter X and enclosed in single quotes. For example:
    X'10A665B'
    X'00FF'
Numeric literals include integers and floating-point numbers. You can specify literals of type money as strings or numbers (for example, '$10.50' or 10.5).
How You Use Hexadecimal for Nonprintable Characters
You can represent printable characters literally as strings. To specify a nonprintable character, use a hexadecimal literal of the form:
X'nn{nn}'
In this form, each character is represented as two hexadecimal digits (nn). For example, the following statement inserts the string "XYZcarriage return" into "col1" and a numeric into "col2" of "table1":
insert into table1 (col1, col2) 
    values (X'58595A0D', 500);
The hexadecimal literal is translated to the corresponding character value.
Last modified date: 08/14/2024