1

Topic: Why concatenation does not work?

Kind night!

select ascii (q)
,q
,' the Letter: ' || q
from (
select ' A ' q from dual
union all
select ' a ' q from dual
union all
select '  ' q from dual
union all
select '  ' q from dual
union all
select chr (246) q from dual)

Why the letter '  ' with the code 246 at concatenation is lost? How it can be solved?
Thanks!

2

Re: Why concatenation does not work?

Adylov Timur;
[spoiler]

select ascii (q)
,q
,' the Letter: ' || q
, (SELECT value FROM NLS_DATABASE_PARAMETERS where parameter = ' NLS_CHARACTERSET ') as NLS_CHARACTERSET
from (
select ' A ' q from dual
union all
select ' a ' q from dual
union all
select ' z ' q from dual
union all
select ' AND ' q from dual
union all
select '  ' q from dual
union all
select convert ('  ', ' cl8mswin1251 ') q from dual
union all
select '  ' q from dual
union all
select chr (246) q from dual);

[/spoiler]
ASCII (Q), Q, ' THE LETTER: ' || Q, NLS_CHARACTERSET
65, A, A letter: A, AL32UTF8
97, a, A letter: a, AL32UTF8
122, z, A letter: z, AL32UTF8
53392, And, The Letter: And, AL32UTF8
53638, , A letter: , AL32UTF8
246, -, A letter: AL32UTF8
53414, , The Letter: , AL32UTF8
246, -, A letter: AL32UTF8

3

Re: Why concatenation does not work?

Adylov Timur wrote:

As it can be solved?

not to confuse bytes to characters. And to use for conversion of the first in last (as well as on the contrary) correct API with instructions of the coding of sequence of bytes:

SQL> select utl_i18n.raw_to_char (to_char (246, ' fmxx '), ' cl8mswin1251 ') as byte_to_char from dual;
BYTE_TO_CHAR
-------------------------------------------------------------------------------------------------

And CHR to use only for some service codes like 10 or 13.

4

Re: Why concatenation does not work?

Elic;
Thanks.
And how now to receive from this character reverse code 246??

5

Re: Why concatenation does not work?

The question is removed, itself understood!

select to_number (utl_i18n.string_to_raw (utl_i18n.raw_to_char (to_char (246, ' fmxx '), ' cl8mswin1251 '), ' cl8mswin1251 '), ' xx ') as byte_to_char
from dual;

Thanks!

6

Re: Why concatenation does not work?

Adylov Timur wrote:

And how now to receive from this character reverse code 246??

In what coding?
[spoiler]

Elic wrote:

on the contrary

[/spoiler]