Working With Oracle on Windows: Part 2 - Tables in Oracle
(Page 5 of 7 )
Now we know a little bit about databases, it is time to create one that works well for you. Let’s start.
What we need to know are what data types Oracle 9i has built-in. Oracle’s built-in data types may be found at http://www.sbg.ac.at/docu/man/oracle/9i/appdev.901/a89857/oci03typ.htm
The list is as follows,
Internal Oracle Datatype | Maximum Internal Length (bytes) | Datatype Code |
VARCHAR2, NVARCHAR2 | 4000 | 1 |
NUMBER | 2 | 2 |
LONG | 2^31-1 (= 2 gigabytes) | 8 |
ROWID | 10 | 11 |
DATE | 7 | 12 |
RAW | 2000 | 23 |
LONG RAW | 2^31-1 (= 2 gigabytes) | 24 |
CHAR, NCHAR | 2000 | 96 |
User-defined type (object type, VARRAY, Nested Table) | N/A | 108 |
REF | N/A | 111 |
CLOB, NCLOB | 4 gigabytes | 112 |
BLOB | 4 gigabytes | 113 |
BFILE | 4 gigabytes | 114 |
TIMESTAMP | 11 | 180 |
TIMESTAMP WITH TIME ZONE | 13 | 181 |
INTERVAL YEAR TO MONTH | 5 | 182 |
INTERVAL DAY TO SECOND | 11 | 183 |
UROWID | 3950 | 208 |
TIMESTAMP WITH LOCAL TIME ZONE | 11 | 231 |
A way of doing this is by simply typing,
CREATE TABLE firstTable
(
v_id NUMBER PRIMARY KEY,
v_firstName VARCHAR2(25),
v_surname VARCHAR2(30)
)
/
Another way to create a table is by using a user defined schema object (i.e. an object that has been created by you).
Next: User Defined Schema Objects >>
More Oracle Articles
More By Ben Shepherd