And on the seventh day, God fiddled with His NLS settings

This page has been moved to http://andrewfraserdba.com/?p=38

Advertisements

4 Responses to “And on the seventh day, God fiddled with His NLS settings”

  1. Simon Kelsey Says:

    Hi Andrew,

    I read this post with interest, I’ve worked in a few places where there have been all manner of NLS “nightmares” but I’ve never come across this particular one! Thanks for the warning!

    Cheers,
    SimonK.

  2. greg Says:

    “The fix is to name the day of the week rather than count to it:

    select address, ‘These customers want visited Saturdays’
    from customer
    where to_char(workdate,’Dy’) = ‘Sat’ ;”

    No, it’s NOT. That’s still NLS dependent. Use ‘J’:

    SQL> alter session set NLS_LANGUAGE = ‘HUNGARIAN’;

    Session altered

    SQL> select to_char(sysdate,’D Day, Dy’), mod(to_number(to_char(sysdate,’J’)),7) from dual;

    TO_CHAR(SYSDATE,’DDAY,DY’) MOD(TO_NUMBER(TO_CHAR(SYSDATE,
    ————————– ——————————
    5 Péntek , P. 4

  3. Eric Says:

    You can depend on the name of the day if you force the language in your to_char function. So no matter the session NLS setting it would return in your reference language, say english.

    where to_char(workdate,’Dy’,’nls_date_language=english’) = ‘Sat’

  4. And on the seventh day, God fiddled with His NLS settings « Andrew Fraser DBA Says:

    […] But, only in America.* […]

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: