Sem 3‎ > ‎DBMS (SQL) LAB‎ > ‎

Prep: Data Types

posted Nov 10, 2011, 1:08 AM by Neil Mathew   [ updated Nov 10, 2011, 1:27 AM ]

Already briefly discussed: Datatypes

Note: Noticed in oracle:

NUMBER ( 5, 2 ) is a floating type number which allows a column to have a 5digit number with two decimal places. That is, only 3 non-decimal places are allowed. eg: 300.02

I had some errors arising because I entered less digits in the decimal places or too many overall. Just a note.

CHAR(size)Fixed length character data of length size bytes. This should be used for fixed length data. Such as codes A100, B102...
VARCHAR2(size)Variable length character string having maximum length sizebytes.
You must specify size
NUMBER(p,s)Number having precision p and scale s.

LONGCharacter data of variable length (A bigger version the VARCHAR2 datatype)
up to 2 Gbytes of data

RAW(size)Raw binary data of length size bytes
used for byte-oriented data (to store character strings, floating point data, and binary data such as graphics images and digitized sound )
You must specify size for a RAW value.
LONG RAWRaw binary data of variable length. (not intrepreted by PL/SQL)

NCLOBNational Character Large Object

BLOBBinary Large Object
like graphics, sound,etc

CLOBCharacter Large Object
like text,memos, etc

BFILEpointer to binary file on disk

DATEValid date range

The NUMBER datatype 

Stores zero, positive, and negative numbers, fixed or floating-point numbers

Fixed-point NUMBER
precision p = length of the number in digits 
scale s = places after the decimal point, or (for negative scale values) significant places before the decimal point. 

Integer NUMBER
This is a fixed-point number with precision p and scale 0. Equivalent to NUMBER(p,0) 

Floating-Point NUMBER
floating-point number with decimal precision 38