You are here: Functions > PACKED()

PACKED()

PACKED() converts a number to a packed field type of a specified length.

Use PACKED() to create numeric data in packed format. This may be required when creating data to be read by external applications. For information on the packed field type see Packed.

See UNSIGNED() for an alternative method of converting numeric data.

Note: Since the output from this function is not printable, you should generally include it only in conjunction with creating a file. A View will not display the data as you expect. In the examples below, results are expressed as hexadecimal strings.

Function Format

PACKED(N1,#)

PACKED() converts N1 to PACKED data with the length, in bytes, specified by #. If # is too short to store all of N1, significant digits are truncated.

Examples

PACKED(75,3) = 00075C

PACKED(7.5,3) = 00075C

PACKED(-12.456,6) = 00000012456D

PACKED(-12.456,2) = 456D

To create an 8-byte PACKED field value containing each employee’s salary specify:

PACKED(SALARY,8)