In this Oracle tutorial, we will learn about the Clob datatype in the oracle database. Also, we will illustrate how to use it to create Clob columns for a table in oracle.
Introduction to Oracle Clob datatype
The CLOB (Character Large Object) datatype in Oracle 21c is used to store character data that can be larger in size than other data types such as varchar2 or char. This type of data is stored as text and can be used to store things like long descriptions, notes, and comments.
Advantages of Clob datatype
- Large data storage: CLOB datatype can store character data up to 4GB in size, making it suitable for storing large amounts of text-based data.
- Text-based data storage: CLOB data is stored as text, making it more efficient for storing and retrieving text data than storing it as binary data.
- Compatibility with other data types: CLOB data can be converted to and from other data types, making it easy to work with other data in your database.
Also, check: How to Check Oracle Database Version
Oracle Clob datatype Syntax
The syntax for declaring a column with the CLOB data type in Oracle 21c is as follows:
Oracle Clob datatype Example
In this example, we will create a table named “employees” with three columns. The “description” column is of the CLOB data type and can be used to store character data.
CREATE TABLE employees ( emp_id NUMBER, emp_name VARCHAR2(30), description CLOB );
The “description ” column in this example has a CLOB data type.
Now we will insert the values in a given table
INSERT INTO employees (emp_id, emp_name, description) VALUES (782, 'Micheal', 'This is a description of item 1');
Read: How to drop database in Oracle
Now, we will discuss how to use the clob datatype in the SQL developer tool. First, we will create a table of students and use the clob datatype for it.
Now we will insert the values into a students name table
INSERT INTO students VALUES (892, 'I studied in a 7th class');
Also, check: Oracle Create Index
Storage and performance
In terms of performance, the CLOB data type can be slow when compared to other data types, as it requires additional processing time to retrieve the data from a separate location.
However, the CLOB data type offers better performance when it comes to handling large amounts of text data, as it is optimized for storing and processing large amounts of text data.
So, in this Oracle tutorial, we understood how to define and use the clob 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 Timestamp Datatype
- Oracle Blob Datatype
- Oracle Binary_double Datatype
- Date Datatype in Oracle Database
- Char Datatype in Oracle Database
- Oracle Varchar2 Datatype
- Nchar Datatype in Oracle Database
- NVARCHAR2 Datatype in Oracle Database
- Float Datatype in Oracle Database
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.