In this Oracle tutorial, we will learn about the Nchar datatype in the oracle database. Also, we will demonstrate how to use it to create Nchar columns for a table in oracle.
Introduction to Oracle Nchar datatype
A word string that can store Unicode information is known as an n-char and the nchar stands for national character.
NCHAR can only use the national character sets AL16UTF16 or UTF8, which are defined when the database is created.
Oracle Nchar datatype Syntax
So far, we’ve clarified the meaning of the Nchar datatype and discussed how it’s used in databases. The next step will be to learn how to utilize it to add Nchar columns to an Oracle table.
The syntax for using a Nchar datatype in Oracle 21c, which is provided below, must be understood in order to perform this in an example.
column_name datatype(size)
where column_name is the name of the column, the datatype is nchar, and size is the number of characters that the column can store. The size of a nchar column must be specified in characters, and the maximum size is 2000 characters.
Also, check: How to add a column to a table in Oracle
Oracle Nchar datatype Examples
Note that the nchar datatype uses twice the amount of storage as the char datatype because it stores each character as two bytes in the database.
Now we will create a table by statement and check how we can use the Nchar datatype in the given department table.
CREATE TABLE department (
dept_id number,
department_name nchar(100),
job_title nchar(50)
);
Now we will insert the data into a table
INSERT INTO department (dept_id, department_name, job_title)
VALUES (872, 'Micheal', 'Manager');
INSERT INTO department (dept_id, department_name, job_title)
VALUES (672, 'John', 'Developer');

Read: How to add a primary key in Oracle
Now, we will discuss how to use the Nchar datatype in the SQL developer tool manually.

Here, we inserted the column name ‘Country_name’ and provide the Nchar datatype with the size (100).
Now we will insert the values into a table.
INSERT INTO country (country_name) VALUES ('U.S.A');

You can use the final statement to determine the current national character set
SELECT
*
FROM
nls_database_parameters
WHERE
PARAMETER = 'NLS_NCHAR_CHARACTERSET';

Also, check: Char Datatype in Oracle Database
The description column has a maximum byte length of 20 bytes since each character in the AL16UTF16 character set requires two bytes to store.
Conclusion
So, in this Oracle tutorial, we understood how to define and use the Nchar Datatype in Oracle Database. And we have also covered a few sample examples related to it.
Also, take a look at some more Oracle tutorials.
- Oracle Varchar2 Datatype
- NVARCHAR2 Datatype in Oracle Database
- Char Datatype in Oracle Database
- Oracle Add Row Number
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.