My guess: the EMPT_TABLE is a remote alias which points to a DB2 system
that resides on a machine which has another character set, so the
char x'7d' is translated to the } sign.
It is no good idea to deal with hex codes when char translations
can occur.
I would simply code
SELECT '''', CHAR(EMPNAME,8), ''',' FROM EMPT_TABLE;
then you get apostrophes regardless of the charset of the target machine.
Kind regards
Bernd
Am Samstag, 25. August 2012 10:49 schrieb P.K.:
> Dear Listers,
>
> I am trying to include ' before and after the column value in my query
> output.
>
> When I run below query:
>
> SELECT CHAR(X'7D') FROM SYSIBM.SYSDUMMY1 ;
> The result is as desired :
> '
>
> But when I run below query :
>
> SELECT CHAR(X'7D') , CHAR(EMPNAME,8) , CHAR(X'7D') ,CHAR(',')
> FROM EMPT_TABLE
> The result is :
> }ABB5251B},
> }ABB5251B},
> }ABB5251B},
> }ABB5251B},
> }ABB5251B},
> }ABB5251B},
> }ABB5251B},
>
> Please advise what am I missing. Please suggest if there is any other way
> of getting ' as part of the query output.
>
> Thanks in advance for your help.
> ________________________
> P.K.
>
|