Have some dates in my local Oracle 11g database that are in this format:
01-JUL-85
How do I change it to this format (mm/dd/yyyy) using PL/SQL:
7/01/1985
With thanks…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the column is a date datatype then it is only your
NLS_DATEsettings that are causing them to be displayed in the formatDD-MON-YYYY.To check your current NLS_DATE format run the following:
Oracle stores all dates in an internal binary format and uses the NLS_DATE format to display them (unless explicitly told to display them differently).
You can either alter your
NLS_DATEsettings toMM/DD/YYYYorTO_CHARthe date column using:to see the format you require.
You can alter the NLS_DATE format for your current session or alter the database parameters to change the default NLS_DATE format for the database itself.
If the column is a VARCHAR2 type then you’ll need to convert to a date first and then you can format the output using either of the methods described above.
See: http://ss64.com/ora/syntax-nls.html
and: http://www.dba-oracle.com/t_nls_date_format_sysdate.htm
e.g.
or
In pure PL/SQL