Insert the current date to Oracle (sysdate is used). The time is accurate to the current day. The current time format is the default time format of Oracle.
Insert the current date to Oracle (sysdate is used). The time is accurate to the current day. The current time format is the default time format of Oracle.
1. Insert the current time to the database
Insert the current date to Oracle (sysdate)
Example: insert into table (date) value (sysdate); // insert the system time and date
The time is accurate to the day. The current time format is the default time format of Oracle.
DD-MON-RR)
1. Temporarily modify the default Oracle time
Change the default time format of Oracle:
SQL> alter session set nls_date_format = 'yyyy-mm-dd ';
2012-12-10
YYYY: MM: DD HH24: MI: SS this is accurate to the second format
The session has been changed.
This is only a temporary modification time format. If the server is restarted, the default time format is still the original
2. Change the time format permanently:
In the Registry's KEY_LOCAL_MACHINE-> SOFTWARE-> ORACLE-> HOME0
Add the string value NLS_DATE_FORMAT. Set it to YYYY-MM-DD-HH24: MI: SS.
For example, modify the parameter file. You can add the following in the parameter file:
NLS_DATA_FORMAT = YYYY-MM-DD-HH24: MI: SS, but the NLS_LANG string value at the preceding position in the registry must be removed.