In this Oracle tutorial, we will learn about the NVARCHAR2 datatype in the oracle database. Also, we will demonstrate how to use it to create NVARCHAR2 columns for a table in oracle.
Introduction to Oracle NVARCHAR2 datatype
A Unicode data type that can store Unicode characters is NVARCHAR2. When the database was created, the national character set was specified as the NVARCHAR2 character set.
Variable-length character data is stored in the NVARCHAR2. The character length meanings are always the default and only length semantics for the NVARCHAR2 data type, hence they are always used when creating tables with NVARCHAR2 columns.
Oracle NVARCHAR2 datatype Syntax
Until now, we have understood the NVARCHAR2 datatype in a database and discussed the purpose of the floating point. Next, we will take a step further and understand how to use it to create NVARCHAR2 columns for a table in oracle.
For this, we need to understand the syntax to use an NVARCHAR2 datatype in oracle 21c which is given below.
NVARCHAR2(max_size BYTE)
NVARCHAR2(max_size CHAR)
Depending on the MAX STRING SIZE, the maximum length of any value that can be put in an NVARCHAR2 column is 32767 or 4000 bytes.
Also, check: Oracle Database vs MySQL Database
Oracle float datatype Examples
After discussing the syntax, we will now discuss the example of how to use the NVARCHAR2 datatype in oracle 21c.
Here we will discuss how to manually use the NVARCHAR2 datatype in the SQL developer tool.
Recommendation: How to create a database in Oracle 19c

After creating the table, we will insert the column name and provide the datatype in this example, we utilize the NVARCHAR2 datatype with size(20).

Now we will insert the values into a table.
INSERT INTO student VALUES ('George');
Now we will use the select statement for showing the ‘student_name’ column value
select * from student;

Example:
Now we will create a table by statement and check how we can use the NVARCHAR2 datatype in the given employees table.
CREATE TABLE employees (
emp_name NVARCHAR2(25)
);
The maximum allowed byte length for the emp name column is 200 bytes, and the default character set is UTF-16.
Note that the sum of the maximum character length and the maximum number of bytes contained in each character yields the maximum byte length.
Now we will insert the values in the emp_name column table
INSERT INTO employees VALUES('George');
To obtain more specific information on the value kept in the employees table, we utilize the DUMP() function.
SELECT
emp_name,
DUMP(emp_name,267)
FROM
employees;

As shown in the result, the datatype is and the length is 12 bytes (6 characters, 2 bytes each).
Read: How to Check Oracle Database Version
Oracle NVARCHAR2 datatype max length
Depending on the MAX STRING SIZE, the maximum length of any value that can be put in an NVARCHAR2 column is 32767 or 4000 bytes.
Conclusion
So, in this Oracle tutorial, we understood how to define and use the Oracle NVARCHAR2 Datatype. And we have also covered a few sample examples related to it.
Also, take a look at some more Oracle tutorials.
- Float Datatype in Oracle Database
- Nchar Datatype in Oracle Database
- Oracle Varchar2 Datatype
- Char Datatype in Oracle Database
- How to convert rows into columns in Oracle
- How to add a foreign key in Oracle
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.