Database Reference
In-Depth Information
Table 16.1
Oracle Simple Datatypes.
Datatype
Parameters
Example
VARCHAR2(n)
n = 1 to 4,000
VARCHAR2(25)
Text string with variable length up to 4,000 bytes. If the col-
umn data's length is shorter than
, Oracle adjusts the length
of the column to the size of the data. Trailing blanks are trun-
cated. Use VARCHAR2 in favor of CHAR to avoid wasting
space. VARCHAR is still a valid datatype but is replaced in
favor of VARCHAR2.
n
CHAR(n)
n = 1 to 2000
CHAR(14)
Same as VARCHAR2 except it holds up to 2,000 bytes and is
a static (fixed-length) text string, regardless of the length of the
data. Trailing blanks are preserved. Shorter data is padded to
right with blanks. CHAR is the same as CHAR(1). Use
CHAR rather than VARCHAR2 for short strings of a semi-
fixed length or precisely known number of characters.
NVARCHAR2(n)
n = 1 to 4,000
NVARCHAR2(65)
Same as VARCHAR2, except that it stores characters for any
language (national character set) supported by Oracle.
NCHAR(n)
n = 1 to 2,000
NCHAR(30)
Same as CHAR, except that the characters stored depend on a
national character set (e.g., Chinese characters).
NUMBER(p,s)
p = 1 to 38, s = -84 to 127
NUMBER(10,2)
Precision (
) is
the number of digits to the right of the decimal. Oracle rounds
data you insert if it has too many decimal places.
p
) is the total number of digits, and the scale (
s
INTEGER
38-byte number
Creates the same datatype as
NUMBER(38).
SMALLINT
38-byte number
Creates the same datatype as
NUMBER(38).
FLOAT(p)
p = 1 to 126
FLOAT(20)
A floating-point or real number.
DATE
None
DATE
Search WWH ::




Custom Search