Markus wrote:
This is my TABLE:
CREATE TABLE test(
data BLOB
)
This is my INSERT:
INSERT INTO test(data) VALUES (CAST('I am a test' AS BLOB))
But how can I SELECT the data as VARCHAR, so that I can see "I am a
test" instead of BLOB-value?
Given that BLOBs contain binary data - that's the first 'B' - you have to
write your own function to do such a conversion.
Note that any byte in the binary data could be 0x00, and that's the
end-of-string character in C/C++, effectively truncating all the data after
that byte if you would just take binary data and treat it like a string.
(Other questions like non-printable characters and such are yet another
issue with binary vs. string data.)
--
Knut Stolze
DB2 Information Integration Development
IBM Germany