This is Argyn's blog. I comment on topics of my interests such as software, math, finance, and music. Also, I write about local events in Northern Virginia, USA and all things related to Kazakhstan

Thursday, March 27, 2008

Internal representation of the DATE datatype

SQL> create table dates (d date);

Table created.

SQL> insert into dates values (to_date('18/APR/2002 15:06:00', 'DD/MON/YYYY HH24:MI:SS'));

1 row created.

SQL> select dump(d) from dates;

Typ=12 Len=7: 120,102,4,18,16,7,1

byte 1: century + 100
byte 2: year + 100
byte 3: month
byte 4: day of month
byte 5: hour + 1
byte 6: minute + 1
byte 7: second + 1

It describes the internal representation of Oracle date field. It was very helpful today for me while troubleshooting production issue.

No comments: