Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLOB vs. VARCHAR2 and are there other alternatives?

I am using DevArt's dotConnect and Entity Developer for my application. I've created the tables using the Entity-First feature.

I notice that many of the column types are set to CLOB. I only have experience with MySQL and Microsoft SQL server, so I am not sure about using CLOB for the application. I did some reading, and found out that CLOB are for large chunk of data.

The questions are:

  1. Is using CLOB for most fields, such as the user's gender (which should be a varchar (1) ) or the full name, feasible? The steps for converting a CLOB field to VARCHAR2 requires dropping the column then re-creating it, and is buggy in DevArt's Entity Explorer, so I would like avoid it if possible. Edit: I just found out that if you set a maximum length for a string field it'll automatically be a VARCHAR2.

  2. Are there any equivalents for TINYTEXT in Oracle?

like image 661
Extrakun Avatar asked Apr 20 '11 13:04

Extrakun


People also ask

Can we use CLOB instead of VARCHAR2 in Oracle?

1) if you are storing 4000 bytes or less in the database, use VARCHAR2 otherwise use CLOB. 2) if you are storing 32k bytes or less in PLSQL use VARCHAR2 otherwise use CLOB.

What is the difference between CLOB and Nclob?

The primary difference between these types is that the CLOB type uses 1 byte per character to store characters in the ASCII character set while the NCLOB type uses 2 or 3 bytes per character to store characters in the Unicode character set. The BLOB (Binary Large Object) type can store data in binary format.


1 Answers

Using a CLOB for something like a Gender column would, at a minimum, be extremely unusual. If the DDL this tool generates specifies that the LOB data should be stored inline rather than out of line, I wouldn't expect to be any horrible performance issues. But you probably will create problems for other tools accessing the database that don't handle LOBs particularly well.

There is no equivalent in Oracle to Tinytext in MySQL. A CLOB is a CLOB.

like image 66
Justin Cave Avatar answered Sep 21 '22 07:09

Justin Cave