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.