Posted: Tue Sep 19, 2006 8:42 am Post subject: Converting from BLOB to CHAR
Voyager
Joined: 28 Nov 2004 Posts: 76
Good People
Using ESQL, how can I cast a BLOB data type to CHAR data type?
For example
DECLARE bData BLOB;
SET bData = Substring(InputRoot.BLOB.BLOB from 4 for 4);
SET Environment.chData = CAST (bData as CHAR);
The message flow debugger displays expected message types; e.g. SET Environment.chData is CHARACTER but the contents are represented as with value X'42434143'.
Subquent String functions on Environment.chData do not provide expected results; e.g
DECLARE myVar CHAR;
SET myVar= SUBSTRING(Environment.chData from 1 for 1);
...myVar contians 'X'
If it's not coming out the way you expect it to, you probably need to supply a CCSID parameter. _________________ I am *not* the model of the modern major general.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum