SQL tutorial | Interview questions | Oracle
Would you like to react to this message? Create an account in a few clicks or log in to continue.

SQL Oracle data types

Go down

SQL Oracle data types Empty SQL Oracle data types

Post by Micheal Wed Jan 27, 2010 5:56 am

Oracle offers the following basic data types:
• char(n): Fixed-length character data (string), n characters long. The maximum size for
n is 255 bytes (2000 in Oracle8). Note that a string of type char is always padded on
right with blanks to full length of n. (+ can be memory consuming).
Example: char(40)
• varchar2(n): Variable-length character string. The maximum size for n is 2000 (4000 in
Oracle8). Only the bytes used for a string require storage. Example: varchar2(80)
• number(o, d): Numeric data type for integers and reals. o = overall number of digits, d
= number of digits to the right of the decimal point.
Maximum values: o =38, d= −84 to +127. Examples: number(Cool, number(5,2)
Note that, e.g., number(5,2) cannot contain anything larger than 999.99 without resulting
in an error. Data types derived from number are int[eger], dec[imal], smallint
and real.
• date: Date data type for storing date and time.
The default format for a date is: DD-MMM-YY. Examples: ’13-OCT-94’, ’07-JAN-98’
1
• long: Character data up to a length of 2GB. Only one long column is allowed per table.
Note: In Oracle-SQL there is no data type boolean. It can, however, be simulated by using
either char(1) or number(1).
As long as no constraint restricts the possible values of an attribute, it may have the special
value null (for unknown). This value is different from the number 0, and it is also different
from the empty string ’’.

Micheal
Admin

Posts : 243
Join date : 2010-01-10

http://sql-tutorial.co.cc

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum