HEX
expression must be an expression that returns a value of any of the following data types:
- SMALLINT
- INTEGER
- BIGINT
- FLOAT
- REAL
- DECIMAL
- DECFLOAT
- DATE
- TIME
- TIMESTAMP
- TIMESTAMP WITH TIME ZONE
- CHAR
- VARCHAR
- GRAPHIC
- VARGRAPHIC
The result is a string of hexadecimal digits. The first two represent the first byte of the argument, the next two represent the second byte of the argument, and so on. If the argument is a datetime value, the result is the hexadecimal representation of the internal form of the argument. If the argument is a numeric value, the result is the hexadecimal representation of the decoded form of the argument.
If the argument is a fixed-length string and the length of the result is less than 255, the result is a fixed-length string. Otherwise, the result is a variable-length string with a length attribute that depends on the following rules:
- If the argument is not a variable-length string, the length attribute of the result string is the same as the length of the result.
- If the argument is a variable character or binary string, the length attribute of the result string is twice the length attribute of the argument.
- If the argument is a variable graphic string, the length attribute of the result string is four times the length attribute of the argument.
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*