Unix Technical Forum

setting NLS_DATE_FORMAT globally rather than per session?

This is a discussion on setting NLS_DATE_FORMAT globally rather than per session? within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I've received a request for NLS_DATE_FORMAT to be set globally in a database to "Mon dd yyyy hh:mi:ssAM" so ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 01:04 PM
Mark Harrison
 
Posts: n/a
Default setting NLS_DATE_FORMAT globally rather than per session?

I've received a request for NLS_DATE_FORMAT to be set globally in a
database to "Mon dd yyyy hh:mi:ssAM" so that ad hoc queries that
use the time don't have to use the to_date function.

Is this a reasonable or common thing to do? We're in a single
timezone in a single country, so there are no localization
issues to worry about.

TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 01:04 PM
sybrandb@hccnet.nl
 
Posts: n/a
Default Re: setting NLS_DATE_FORMAT globally rather than per session?

On Thu, 21 Jun 2007 19:03:33 GMT, Mark Harrison <mh@pixar.com> wrote:

>I've received a request for NLS_DATE_FORMAT to be set globally in a
>database to "Mon dd yyyy hh:mi:ssAM" so that ad hoc queries that
>use the time don't have to use the to_date function.
>
>Is this a reasonable or common thing to do? We're in a single
>timezone in a single country, so there are no localization
>issues to worry about.
>
>TIA!
>Mark


It is a thing that won't work, as NLS setting are always overridden by
the client. If the client didn't set them they are overridden to the
defaults of the particular Oracle port.

--
Sybrand Bakker
Senior Oracle DBA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 01:04 PM
Ana C. Dent
 
Posts: n/a
Default Re: setting NLS_DATE_FORMAT globally rather than per session?

Mark Harrison <mh@pixar.com> wrote in news:9Yzei.2715$vi5.1180
@newssvr17.news.prodigy.net:

> I've received a request for NLS_DATE_FORMAT to be set globally in a
> database to "Mon dd yyyy hh:mi:ssAM" so that ad hoc queries that
> use the time don't have to use the to_date function.


HUH?

> don't have to use the to_date function.


TO_DATE is used to convert strings to date datatype!

Are you sure you even know how to spell S-Q-L?



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 01:04 PM
Laurenz Albe
 
Posts: n/a
Default Re: setting NLS_DATE_FORMAT globally rather than per session?

Ana C. Dent <anacedent@hotmail.com> wrote:
> HUH?
>
> Are you sure you even know how to spell S-Q-L?


Idiot. The question was very reasonable. Go away.

Laurenz Albe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 01:04 PM
Martin T.
 
Posts: n/a
Default Re: setting NLS_DATE_FORMAT globally rather than per session?

On Jun 21, 9:03 pm, Mark Harrison <m...@pixar.com> wrote:
> I've received a request for NLS_DATE_FORMAT to be set globally in a
> database to "Mon dd yyyy hh:mi:ssAM" so that ad hoc queries that
> use the time don't have to use the to_date function.
>
> Is this a reasonable or common thing to do? We're in a single
> timezone in a single country, so there are no localization
> issues to worry about.
>
> TIA!
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios


What clients are used to run the ad-hoc queries?
Maybe you can find a way so that all the clients have some default
date format. (e.g. login.sql with sqlPlus)

br,
Martin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 01:04 PM
Laurenz Albe
 
Posts: n/a
Default Re: setting NLS_DATE_FORMAT globally rather than per session?

sybrandb@hccnet.nl wrote:
>>I've received a request for NLS_DATE_FORMAT to be set globally in a
>>database to "Mon dd yyyy hh:mi:ssAM" so that ad hoc queries that
>>use the time don't have to use the to_date function.
>>
>>Is this a reasonable or common thing to do? We're in a single
>>timezone in a single country, so there are no localization
>>issues to worry about.

>
> It is a thing that won't work, as NLS setting are always overridden by
> the client. If the client didn't set them they are overridden to the
> defaults of the particular Oracle port.


To go into more detail:

See http://download-uk.oracle.com/docs/c...v.htm#g1012703

If no environment variable/registry setting is set on the client,
the setting will be DD-MON-RR.

If NLS_LANG is set and NLS_DATE_FORMAT is not set, the format will be
derived from the territory part of NLS_LANG.

If NLS_DATE_FORMAT is set, this will be respected.

Additionally, you can use ALTER SESSION to set NLS_TERRITORY or
NLS_DATE_FORMAT for the session.

Here is a (slightly ugly) solution for the problem:

You can create a login trigger for the user that will change the
setting of NLS_DATE_FORMAT for the session.

Yours,
Laurenz Albe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com