Oracle SQL - Data types and size

Introduction

The following table provides a more complete overview of the most important Oracle data types.

Data type Description
CHAR[(n)] Character string with fixed length n (default 1) using the database characterset
VARCHAR|VARCHAR2(n) Variable-length string; maximum n characters using the database characterset
NCHAR[(n)]Character string with fixed length n (default 1) using the national characterset
NVARCHAR|NVARCHAR2(n) Variable-length string; maximum n characters using the national characterset
DATE Date (between 4712 BC and 9999 AD)
TIMESTAMP Timestamp, with or without time zone information
INTERVAL Date/time interval
BLOB Unstructured binary data (Binary Large Object)
CLOB Large text (Character Large Object) using the database characterset
NCLOB Large text (Character Large Object) using the national characterset
RAW(n)Binary data; maximum n bytes
NUMBERCan store any number, maximum precision and scale 38 digits
NUMBER(n) Integer; maximum n digits
NUMBER(n,m) Total of n digits; maximum m digits right of the decimal point
BINARY_FLOAT 32-bit floating-point number
BINARY_DOUBLE 64-bit floating-point number

If you insert values into a NUMBER(n,m) column and you exceed precision n, you get an error message.

If you exceed scale m, the oracle DBMS rounds the value.

Oracle DBMS supports many data type synonyms for portability.

For example, CHARACTER is identical to CHAR; DECIMAL(n,m) is identical to NUMBER(n,m); and NUMBER even has multiple synonyms, such as INTEGER, REAL, and SMALLINT.

Each Oracle data type has its own precision or length limits as shown in the following table.

Data type Limit
NUMBER38 digits
CHAR 2000 bytes
VARCHAR 4000 bytes
VARCHAR2 4000 bytes or 32,767 bytes2
RAW 2000 bytes or 32,767 bytes3
BLOB (4GB - 1) * (database block size)
CLOB (4GB - 1) * (database block size)