Insert Date data into Oracle database

Source: Internet
Author: User

If the current system time of Oracle is inserted, SYSDATE can be used.

Insert into floor values (SYSDATE );

Insert Date data to Oracle Database (to_date usage)
  • Today, I encountered the need to insert date data into the Oracle database. I want to use the TO_DATE function to find a good article on the Internet and share it with me.
  • Insert into floor values (to_date ('2017-12-20 18:31:34 ', 'yyyy-MM-DD HH24: MI: ss '));
  • Query display:2007-12-20 18:31:34. 0
  • -------------------
  • Insert into floor values (to_date ('2017-12-14 ', 'yyyy-MM-DD HH24: MI '));
  • Query display:2007-12-14 14:10:00. 0
  • -------------------
  • Insert into floor values (to_date ('2017-12-14 14', 'yyyy-MM-DD hh24 '));
  • Query display:2007-12-14 14:00:00. 0
  • -------------------
  • Insert into floor values (to_date ('2017-11-15 ', 'yyyy-MM-DD '));
  • Query display:2007-11-15 00:00:00. 0
  • -------------------
  • Insert into floor values (to_date ('2017-09 ', 'yyyy-mm '));
  • Query display:00:00:00. 0
  • -------------------
  • Insert into floor values (to_date ('201312', 'yyyy '));
  • Query display:00:00:00. 0
  • -------------------
  • When the input parameters corresponding to HH, MI, and SS are omitted, Oracle uses 0 as the DEFAULT value.
  • If the input date data ignores the time part, Oracle sets the hour, minute, and second part to 0, that is, it will take the whole day.
  • Similarly, if the DD parameter is ignored, Oracle uses 1 as the default value of the day, that is, it takes the entire month.
  • However, do not be confused by this "inertia". If you ignore the MM parameter, Oracle will not take the entire year, but the entire month.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.