Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Como as datas são armazenadas no Oracle?


Existem dois tipos 12 e 13

http://oraclesniplets.tumblr.com/post/1179958393/my-oracle-support-oracle-database-69028-1

Tipo 13
select dump(sysdate) from dual;
Typ=13 Len=8: 220,7,11,26,16,41,9,0

The format of the date datatype is

Byte 1 - Base 256 year modifier : 220
2      - Base 256 year : 256 * 7 = 1792 + 220 = 2012
3      - Month : 11
4      - Day : 26
5      - Hours : 16
6      - Minutes : 41
7      - Seconds : 09
8      - Unused

26/11/2012 16:41:09

Tipo 12
select dump(begindate) from tab;
Typ=12 Len=7: 100,112,2,7,1,1,1

The format of the date datatype is

byte 1 - century (excess 100)  100 - 100 = 00
byte 2 - year (excess 100)  112 - 100 = 12
byte 3 - month = 2
byte 4 - day = 7
byte 5 - hour (excess 1) 1 - 1 = 0
byte 6 - minute (excess 1) 1 - 1 = 0
byte 7 - seconds (excess 1) 1 - 1 = 0

0012-02-07 00:00:00