Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateMiscellaneous language elements → Hexadecimal notation for numerals
Firebird Home Firebird Home Prev: -- (single-line comment)Firebird Documentation IndexUp: Miscellaneous language elementsNext: Hexadecimal notation for “binary” strings

Hexadecimal notation for numerals

Tip

Find a more recent version at Firebird 5.0 Language Reference: Hexadecimal Notation for Numbers

Available in: DSQL, PSQL

Added in: 2.5

Description: In Firebird 2.5 and up, integer values can be entered in hexadecimal notation. Numbers with 1–8 hex digits will be interpreted as INTEGERs; numbers with 9–16 hex digits as BIGINTs.

Syntax: 

0{x|X}<hexdigits>

<hexdigits>  ::=  1–16 of <hexdigit>
<hexdigit>   ::=  one of 0..9, A..F, a..f

Examples: 

select 0x6FAA0D3 from rdb$database           -- returns 117088467
select 0x4F9 from rdb$database               -- returns 1273
select 0x6E44F9A8 from rdb$database          -- returns 1850014120
select 0x9E44F9A8 from rdb$database          -- returns -1639646808 (an INTEGER)
select 0x09E44F9A8 from rdb$database         -- returns 2655320488 (a BIGINT)
select 0x28ED678A4C987 from rdb$database     -- returns 720001751632263
select 0xFFFFFFFFFFFFFFFF from rdb$database  -- returns -1

Value ranges: 

Prev: -- (single-line comment)Firebird Documentation IndexUp: Miscellaneous language elementsNext: Hexadecimal notation for “binary” strings
Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateMiscellaneous language elements → Hexadecimal notation for numerals