I have the same problem and I know the solution. I am using Release 11.2.0.4.0, but I can leave this situation in other versions. It somehow depends on the client. (For example, I cannot repeat it using SQL * Plus, only with PL / SQL Devepoper) Try the following:
select to_char(systimestamp, '"day:"DD" OR any other UTF-encoded-something"') from dual union all select to_char(systimestamp, '"day:"DD"hello"') from dual;
You will get the following result:
day:08 OR any other UTF-encoded-so day:08hello
You can see that the โtaggingโ is lost. This exceeded 7 bytes due to 7 double-byte "yutsukeng" characters. Oracle allocates a buffer for the number of characters, not the number of bytes required. Team
alter session set nls_length_semantics=byte/char
Unfortunately, this behavior is not affected.
So my solution is to pass the result as varchar2 (enough_capacity)
select cast(to_char(systimestamp, '"day:"DD" OR any other UTF-encoded-something"') as varchar(1000)) from dual union all select to_char(systimestamp, '"day:"DD"hello"') from dual
Explicit casting makes the expression independent of the client or configuration. By the way, the same thing happens in all implicit to_char transforms. For instance.
case [numeric_expression] when 1 then '[unicode_containing_string]' end
The result can be cut off.
source share