René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Datatypes in Oracle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Internal datatypes
User defined datatypes
A user defined datatype can be created with create type.
The code is 108, the
#define is SQLT_NTY.
PL/SQL datatypes
In addition to the internal datatypes, Oracle also knows the following datatypes within PL/SQL:
anydata, anytype and anydataset
See here.
ANSI datatypes
The following table list ANSI datatypes and its corresponding Oracle datatype:
The ANSI datatypes can be used ....
create table ansi_data_types ( col_01 character(10), col_02 character varying(20), col_03 national character(30), col_04 national character varying(40), col_05 decimal(5,2), col_06 numeric(9,3), col_07 integer, col_08 int, col_09 smallint, col_10 float, col_11 double precision, col_12 real );
... but are implicitely converted to Oracle datatypes:
desc ansi_data_types Name Null? Type ----------------------------------------- -------- ---------------------------- COL_01 CHAR(10) COL_02 VARCHAR2(20) COL_03 NCHAR(30) COL_04 NVARCHAR2(40) COL_05 NUMBER(5,2) COL_06 NUMBER(9,3) COL_07 NUMBER(38) COL_08 NUMBER(38) COL_09 NUMBER(38) COL_10 FLOAT(126) COL_11 FLOAT(126) COL_12 FLOAT(63) Unsupported DB2 datatypes
The following datatypes, valid in DB2, are not supported in Oracle:
Links
See also dbms_types.
lobs (CLOB, BLOB, NCLOB and BFILE).
|