Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: HELP! Default date format in SQL*Plus isn't dd-mon-yy!

Re: HELP! Default date format in SQL*Plus isn't dd-mon-yy!

From: Andrew Allen <andrew.allen_at_handleman.com>
Date: Thu, 27 Feb 2003 16:55:20 GMT
Message-ID: <3E5E35EE.8010503@handleman.com>


R wrote:

> "Andrew Allen" <andrew.allen_at_handleman.com> wrote in message
> news:3E5CD9A8.1030004_at_handleman.com...
> 

>>R wrote:
>>
>>>Hi!
>>>
>>>I'm in a bind here. Doing some schoolwork and for some reason the
>>
> default
> 

>>>date format produced by SQL*Plus is not the expected dd-mon-year, but
>>>YY-MM-DD. I've tried altering the settings in my Date/Time control panel
>>>with no success.
>>
> 
> <snip>
> 

>>OK, since you admit you are a student I will point you in the proper
>>direction and leave it up to you to find the correct solution(s).
>>1. Oracle stores dates in an internal seven byte date format.
>>2. Oracle displays dates in a default format, as you listed (yy-mm-rr).
>>3. You can change the default display format, as well as comma/point for
>>numbers using NLS settings -- I will leave it up to you to find what
>>these are and how to set them system wide and at the session level.
>>4. NEVER - NEVER - NEVER ( I cannot say it enough ) NEVER rely on
>>default date masks (format). ALWAYS use an explicit TO_DATE() or
>>TO_CHAR() function to store or display dates. This way you never have
>>to worry about the default date display format.
> 
> 

>>It is probably good that you have been bitten by this bit of ( reliance
>>on defalt ) foolihsness while still learning -- perhaps it will help
>>lead you into good programming habits.
> 
> 
> It's not ME! It's the script that was supplied to the students to create the
> default tables for us to work with!
> 
> 

>>BTW, the date/time settings on your PeeCee have NOTHING to do with
>>SQL*Plus and oracle display defaults.
> 
> 
> I still don't understand why the default decimal character would be a comma.
> 

All Right Student R,
Look in the Oracle Reference manual for
NLS_TERRITORY
Then learn how it and NLS_DATE_FORMAT, NLS_NUMERIC_CHARACTERS, NLS_CURRENCY, and NLS_ISO_CURRENCY work. Your default date and number formatting is controlled by these variables.

As I said before, DO NOT RELY ON DEFAULTS.

--
Andrew
Received on Thu Feb 27 2003 - 10:55:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US