Saturday, May 16, 2020

Data Types

Oracle Data Types:

CHAR: Char data type stores fixed-length character strings.

Max Size: Oracle 7 255 bytes Default and minimum size is 1 byte.
Max Size: Oracle 8 2000 bytes Default and minimum size is 1 byte.
Max Size: Oracle 9 2000 bytes Default and minimum size is 1 byte.

VARCHAR or VARCHAR2: This data type stores variable-length character data. Varchar is a deprecated data type and is a synonym for varchar2.

Max Size: Oracle 7 2000 bytes minimum is 1
Max Size: Oracle 8 4000 bytes minimum is 1
Max Size: Oracle 9 4000 bytes minimum is 1

NUMBER: The NUMBER data type stores fixed and floating point numbers. We can specify Precision

(Total number of digits) and scale (number of digits to the right of decimal point).

Max Size: Oracle 7 The precision p can range from 1 to 38.The scales can range from -84 to 127.
Max Size: Oracle 8 The precision p can range from 1 to 38.The scales can range from -84 to 127.
Max Size: Oracle 9 The precision p can range from 1 to 38.The scales can range from -84 to 127.

DATE: The DATE data type stores dates and time in the table.

Max Size:Oracle 7 from January 1, 4712 BC to December 31, 4712 AD.
Max Size:Oracle 8 from January 1, 4712 BC to December 31, 9999 AD.
Max Size:Oracle 9 from January 1, 4712 BC to December 31, 9999 AD.

LONG: The LONG data type stores variable-length character data (bigger than VARCHAR2) up to two gigabytes length. You can use LONG columns to store long text strings.

Max Size:Oracle 7 2 Gigabytes
Max Size:Oracle 8 2 Gigabytes
Max Size:Oracle 9 2 Gigabytes

RAW: This data type stores binary data. We must specify the size for RAW value.

Max Size:Oracle 7 Maximum size is 255 bytes.
Max Size:Oracle 8 Maximum size is 2000 bytes
Max Size:Oracle 9 Maximum size is 2000 bytes

LONG RAW: Raw binary data of variable length.

Max Size:Oracle 7 2 Gigabytes.
Max Size:Oracle 8 2 Gigabytes.
Max Size:Oracle 9 2 Gigabytes.

LARGE OBJECTS (LOBs): The above data types are called traditional oracle data types. LOBs are added from Oracle 8.0 version. From there Oracle 8.0 is considered as ORDBMS (Object relational database management system.). The traditional oracle database is extended to include object-oriented concepts and structures such as abstract data types, nested tables, varying arrays, object views and references.

LOB datatypes are capable of storing large volumes of data. The LOB datatypes available are BLOB, CLOB, NCLOB, and BFILE.

CLOB ( Character Large Object): This data type is used to store character data.

Max Size:Oracle 7
Max Size:Oracle 8 4Gigabytes
Max Size:Oracle 9 4Gigabytes

BLOB ( Binary Large Object): This data type is used for binary data.

Max Size:Oracle 7
Max Size:Oracle 8 4Gigabytes
Max Size:Oracle 9 4Gigabytes

NLOB (National Character Large Object): This datatype is used to store character data containing Unicode characters.( ASCII character is of 1 byte and UNICODE character is of 2 bytes )

Max Size:Oracle 7
Max Size:Oracle 8 4Gigabytes
Max Size:Oracle 9 4Gigabytes

BFILE (Binary File): It is a pointer to external file. The files referenced by BFILE exist in the file system. The database only maintains a pointer to the file. The size of the external file is limited only by the operating system. ORACLE does not maintain concurrency and integrity of the data. 

Note: A table can use more than one LOB. Earlier to LOBs it was possible to have only one LONG datatype column in a table.

No comments:

Post a Comment