Derby INTEGER constants are signed decimal numbers, that is, legal inputs to the java.lang.Integer.valueOf(String s) method. The radix is always 10. Hex/octal constants won't work, as you've discovered.

On 9/24/23 9:05 AM, John English wrote:
Is there a way to use hex constants as integers in Derby?

I tried using X'7FFF' and I got "Comparisons between 'SMALLINT' and 'CHAR () FOR BIT DATA' are not supported". I tried using CAST(X'7FFF' AS INTEGER) and got "Cannot convert types CHAR () FOR BIT DATA to INTEGER".

I can of course use 32767 in this case, but for other hex values it's a real pain to work out what it corresponds to. Or I could define a function to convert a string hex value to an integer, but that also seems like overkill.

Thanks,


Reply via email to