 |
|
EnterpriseDB: Object Identifier (OID)
Oracle Tips by Burleson Consulting
|
OID
OID is
an abbreviation of Object Identifier. EnterpriseDB uses this
special numeric type as an internal Primary Key for system tables.
This OID does NOT correspond to a ROWID. You should NOT use this
special type as a primary key for your tables. You can however use
it for certain specific functions, such as emulating BFILE support
(described below in the Binary Data Types Section).
If we
were to create a table with the numeric types we have discussed, it
would look like this:
CREATE
TABLE number_table (
small_num NUMBER(5),
big_num NUMBER(25),
really_big_num NUMBER,
number_float NUMBER(15,5),
int_field INTEGER,
real_float REAL,
double_float DOUBLE PRECISION,
oid_field OID );
* Note
that DOUBLE PRECSION has a space between DOUBLE and PRECISION and
not an underbar (_).
We can
insert into our table. I won't insert an OID just yet. I'll do that
further below in the binary section.
INSERT
INTO number_table (
small_num, big_num, really_big_num, number_float, int_field,
real_float, double_float)
VALUES
(
12345, 1234567890, 12345678901234567890, 123456.1234, 1234,
109283.2364, 1283723266252533.8372326362636262632);
And we
can select them:
SELECT
small_num,
big_num,
really_big_num,
number_float,
int_field,
real_float,
double_float
FROM
number_table;
The
results of running the above commands:
edb=#
CREATE TABLE number_table (
edb(#
small_num NUMBER(5),
edb(#
big_num NUMBER(25),
edb(#
really_big_num NUMBER,
edb(#
number_float NUMBER(15,5),
edb(#
int_field INTEGER,
edb(#
real_float REAL,
edb(#
double_float DOUBLE PRECISION,
edb(#
oid_field OID );
CREATE
TABLE
edb=#
INSERT INTO number_table (
edb(#
small_num, big_num, really_big_num, number_float, int_field,
real_float, double_float )
edb-#
VALUES
edb-#
( 12345, 1234567890, 12345678901234567890, 123456.1234, 1234,
109283.2364, 1283723266252533.
8372326362636262632);
INSERT
0 1
edb=#
SELECT small_num,
edb-#
big_num,
edb-#
really_big_num,
edb-#
number_float,
edb-#
int_field,
edb-#
real_float,
edb-#
double_float
edb-#
FROM number_table;
small_num
| big_num | really_big_num | number_float | int_field |
real_float
| double_float
-----------+------------+----------------------+--------------+-----------+------------+-----------------------
12345 | 1234567890 | 12345678901234567890 | 123456.12340 |
1234 | 109283 | 1.283723266
25253e+015
(1 row)
edb=#
Date and Time Data
We
will primarily be working with three kinds of date/time data types:
date, timestamp and interval.
This
is an excerpt from the book "EnterpriseDB:
The Definitive Reference" by Rampant TechPress.