You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Choosing the right data types and enforcing constraints is fundamental to good database design. Oracle provides a rich set of data types and constraint mechanisms to ensure data integrity, performance, and storage efficiency.
| Data Type | Description | Max Size |
|---|---|---|
VARCHAR2(n) | Variable-length string (most common) | 4,000 bytes (32,767 with MAX_STRING_SIZE=EXTENDED) |
CHAR(n) | Fixed-length string (padded with spaces) | 2,000 bytes |
NVARCHAR2(n) | Variable-length Unicode string | 4,000 bytes |
NCHAR(n) | Fixed-length Unicode string | 2,000 bytes |
CLOB | Character Large Object | Up to 128 TB |
NCLOB | Unicode Character Large Object | Up to 128 TB |
Tip: Always use
VARCHAR2overCHARunless fixed-length is specifically required.CHARpads with trailing spaces, which can cause unexpected comparison behaviour.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.