Subject ASCII_VAL for BLOB
Author rj1102
Using Firebird 2.5 (WI-V2.5.2.26539),
I try to access a blob with jpeg image, but somehow not all bytes return the right ascii value.

E.g. I know the first byte of the blob is x'FF' since statement below returns 'TRUE':

SELECT IIF(SUBSTRING(Image FROM 1 FOR 1) = x'FF', 'TRUE', 'FALSE')
FROM MyTable WHERE Id = 1

However statement below returns 74 where I expect 255:

SELECT ASCII_VAL(CAST(SUBSTRING(Image FROM 1 FOR 1) AS BLOB))
FROM MyTable WHERE Id = 1

Field Image is defined as BLOB(80, 0)

Is there another reliable manner to retrieve the numeric value of a byte inside a blob?

Thank you very much in advance!

Robert