Search results
To convert a DATE column to another format, just use TO_CHAR() with the desired format, then convert it back to a DATE type: SELECT TO_DATE(TO_CHAR(date_column, 'DD-MM-YYYY'), 'DD-MM-YYYY') from my_table
21 lip 2004 · All dates are stored in a 7 byte machine format (and in 9i, a timestamp might take 11 bytes for timezones and fractional seconds). You can change the default date format using alter session set nls_date_format='mm/dd/yyyy'; but I would strongly DISCOURAGE that.
11 lis 2019 · I would like to use a standard format in my PL/SQL code that does not lead to implicit database conversions between date formats in the table's date columns and user date/string parameters, and at the same time be portable/reusable if the date formats change. I typically chose 'YYYY-MM-DD'.
27 kwi 2020 · If I set nls_date_format to 'mm/dd/yyyy' on a sql*plus session and then run the procedure, I get an error 6502 PL/SQL: numeric or value error, when the cursor tries to fetch values in the format 'dd-mon-yy'.
Set the session date format. alter session set nls_date_format = 'DD-MON-YYYY HH24:MI'
4 sty 2023 · A format model is a character literal that describes the format of datetime or numeric data stored in a character string. A format model does not change the internal representation of the value in the database. When you convert a character string into a date or number, a format model determines how Oracle Database interprets the string.
7 paź 2015 · The literal '27-APR-12' can fail very easily if the default date format is changed to anything different. So make sure you you always use to_date() with a proper format mask (or an ANSI literal: date '2012-04-27')