The simplest solution is to change the semantics of the length of the fields in which it is supposed to store information with non-ASCII characters.
Unicode is used in the examples:
\0430\0431\0432 = абв = 160,161,162 в CP866 или 208,176,208,177,208,178 в UTF8
host chcp Active code page: 866 @[%nls_lang%] SP2-0310: unable to open file "[.RU8PC866]" --кодовые страницы ОС и ДБ сессии клиента совпадают alter table tstcp866 modify (code varchar2(3 char)); Table altered. insert into tstcp866 values ('абв'); 1 row created. select code, dump(code) dc from tstcp866; COD DC --- ----------------------------------------------- абв Typ=1 Len=6: 208,176,208,177,208,178
Thus, in a field 3 characters long, 6-byte fit. There will be no problems with queries with this field, either from other clients or at the database level.
Not recommended solution
You can insert into the same 3rd byte and without changes to the database, but this is the same as polling one and a half to pour out.
To save the source encoding, the client's code page must be the same as the database. In this case, there will be no implicit conversion of data. Those. set the client's environment set NLS_LANG=.AL32UTF8 (or in the registry), and the data will be loaded into the database as it is in CP866.
host chcp Active code page: 866 select * from nls_database_parameters where parameter = 'NLS_CHARACTERSET'; PARAMETER VALUE ------------------------------ -------------------------- NLS_CHARACTERSET AL32UTF8 @[%nls_lang%] SP2-0310: unable to open file "[.AL32UTF8]" create table tstcp866 (code varchar2(3)); insert into tstcp866 values ('абв'); 1 row created. select code, dump(code) dc from tstcp866; COD DC --- ----------------------------------------------- абв Typ=1 Len=3: 160,161,162
The result seems to be achieved, but the field is not valid Unicode. How difficult the query should look at the database level to transcode the field:
select convert(code, 'AL32UTF8', 'RU8PC866') code from tstcp866 where convert(code, 'AL32UTF8', 'RU8PC866')=to_nchar(unistr('\0430\0431\0432')) ; CODE --------------- абв
Once again, this hack is not recommended, because Access only from the client with the "incorrect" installed encoding. In the worst case, for example, with implicit converting, data loss will occur.
bytetochar. This is not a column type change, it will look like -mycol varchar2(3 char). - 0xdb