Oracle gem of the day: NLS_CALENDAR

jdavidb on 2006-12-06T13:54:21

I'm not likely to ever use today's gem, but I am impressed. You can set NLS_CALENDAR in order to use other calendars, such as 'Arabic Hijrah'. Default, of course, is 'GREGORIAN'. I have no idea what other values are permissible. And I'm sure it's not possible for me to define my own calendar and use Shire dating, or my own custom calendar, or something. But still it's neat that they can handle that.


NLS_CALENDAR: Oracle's $[ ?

DAxelrod on 2006-12-06T17:39:28

My first thought was that I could see this being a problem in exactly the same way as Perl's $[ in other words, setting this in too wide of a scope is going to break a lot of code making certain assumptions.

Actually, that's not quite fair. I can at least see where NLS_CALENDAR would be useful. :)

Re:NLS_CALENDAR: Oracle's $[ ?

jdavidb on 2006-12-07T16:36:40

Yeah, Oracle has a lot of settings like that, particularly involving dates. Personally, I'm really bugged by the default datemask: DD-Mmm-YYYY (25-Dec-2006). I'm in the US, using a US product, receiving a date that doesn't look like anything I see on a regular basis and which has no useful sorting properties. You can set this parameter at three levels: for the whole server (augh), for each session, and as an explicit parameter each time you set a date. Strangely enough one system I've been on forever has had this mask changed to DD-mmm-YYYY (25-dec-2006), which looks even weirder. But I just leave this setting alone, which reminds me to always explicitly convert my timestamps, so hopefully I will never accidentally code something that breaks when someone else uses it with a different setting.

A related annoyance is that you can't set this parameter for your session with a bind variable.