Avatar of Bally Jassal
Bally Jassal
Flag for United States of America asked on

Convert Oracle 12c Tables from BYTES to CHAR

Convert Oracle 12c Tables from BYTES to CHAR
I want the tables be converted from BYTE to CHAR on 12.1.0.
I am doing a export dump from a non-Unicode database and the Varchar2 data types is in BYTES (Which is the default).
The import I am doing on is a UNICODE database but import dump is Keeping the same data type as in the source.
Is there a way to change the NLS_LENGTH_SEMANTICS set as CHAR and do the export?
or ; I have to change the NLS_LENGTH_SEMANTICS to CHAR on the target as well?
I am not sure if this will work?

Source:=
SQL> desc PS_GVT_POI_TBL
 Name                                                                                Null?    Type
 ----------------------------------------------------------------------------------- -------- ------------------
SETID                                                                               NOT NULL VARCHAR2(5)
GVT_POI                                                                             NOT NULL VARCHAR2(4)

The result I am looking should look like this (below):=
SQL> desc PS_GVT_POI_TBL
 Name                                                                                Null?    Type
 ----------------------------------------------------------------------------------- -------- ------------------
 SETID                                                                               NOT NULL VARCHAR2(5 CHAR)
 GVT_POI                                                                             NOT NULL VARCHAR2(4 CHAR)
DatabasesOracle Database

Avatar of undefined
Last Comment
Sean Stuber

8/22/2022 - Mon
Peter Chan

Try

select TO_SINGLE_BYTE('Tech on the net')
from dual;

Open in new window


The syntax for the TO_SINGLE_BYTE function in Oracle/PLSQL is:

TO_SINGLE_BYTE( char )
Parameters or Arguments
char
A char, varchar2, nchar, or nvarchar2 value that will be converted to single-byte characters. This function will return its result in the same character set as char.
ASKER CERTIFIED SOLUTION
Sean Stuber

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy