Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the difference in the length of date data in oracle?
What is the difference in the length of date data in oracle?
Oracle data types look simple, but you will find many knowledge points when you use them. This article is my collation of ORACLE date data types, which are all introductory materials for development. I would like to share with you: \x0d\ Note: Because interval and time zone are rarely used, these two aspects are beyond the scope of this article. \x0d\\x0d\ 1, common date data type \x0d\ 1, DATE\x0d\ This is the most common date type in ORACLE, which can save date and time and can be used for common date processing. The date can range from 47 12 1 BC to1ad99991231\ x0d \ date is stored in the database with 7 bytes, and the format is \ x0d \1byte: Byte 3: month \x0d\ byte 4: day \x0d\ byte 5: hour+1\x0d\ byte 6: minute+1\x0d\ byte 7: second+1 \ x0d \ x0d. X0d\ Stores the date and time, and can also store fractional seconds. The number of decimal places can be specified as 0-9, and the default is 6 digits, so the highest precision can be stored as ns (nanosecond), and 7 or 1 1 byte is used in the database. If the precision is \x0d\0, it is stored in 7 bytes, which is the same as the function of date type. If the precision is greater than 0, it is stored in 655438+0 bytes. \x0d\ format: \x0d\ No.65438 +0 byte: century+100\x0d\ No.2 byte: year \x0d\ No.3 byte: month \x0d\ No.4 byte: day \x0d\ No.5 byte: hour. 8th-11byte: nanosecond, stored in 4 bytes. The internal operation type is integer \ x0d \ x0d \ Note: If the timestamp date type is added or subtracted, it will be automatically converted to the date type, that is, the fractional seconds will be automatically removed. \x0d\\x0d\ 1.3, date and timestamp type internal storage verification \ x0d \1createtablet \ x0d \ 2 (\ x0d \ 3c1date, \ x0d \ 4c2timestamp. \x0d\ 6 \x0d\ 7 insert t(c 1, c2) value (date' 20 10-2- 12', timestamp' 2010-2-/kloc-0'. \x0d\ 8 insert into t(c 1, c2) value (\ x0d \ 9to _ date ('2010-2-10: 20: 30',' yyyy'. 10 to _ timestamp(' 20 10-2- 12 65438FF6”)\ x0d \ 1 1); \ x0d \ 12 \ x0d \ 13 SQL & gt; select c 1,dump(c 1) c 1_d,c2,dump(C2)C2 _ d from t;