2.21 @HIGHVAL | LOWVAL

Use the @HIGHVAL and @LOWVAL functions when you need to generate a value, but you want to constrain it within an upper or lower limit. These functions emulate the COBOL functions of the same names.

Use @HIGHVAL and @LOWVAL only with string and binary data types. When using them with strings, only @STRNCMP is valid. Using them with decimal or date data types or with SQLEXEC operations can cause errors. DOUBLE data types result in -1 or 0 (Oracle NUMBER, no precision, no scale).

Syntax

@HIGHVAL ([length]) | @LOWVAL ([length])
length

Optional. Specifies the binary output length in bytes. The maximum value of length is the length of the target column.

Example

The following example assumes that the size of the group_level column is 5 bytes.

Function statement Result
group_level = @HIGHVAL ()
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
group_level = @LOWVAL ()
{0x00, 0x00, 0x00, 0x00, 0x00}
group_level = @HIGHVAL (3)
{0xFF, 0xFF, 0xFF}
group_level = @LOWVAL (3)
{0x00, 0x00, 0x00}