Wednesday, October 30, 2013

Oracle Database - Changing Day Order of the Week after Saudi Arabia Changed Weekend days

I wrote this post before two or three months, but I didn't have the chance to publish it:
here it goes.....


We had a function in which it updates a table that holds today's Umalqura current date, this function perform its calculations depending on Day order of the week and most of user machines we have either (forms6i or ADF "weblogic servers") have Saudi Arabia set as default locale.

The NLS_TERRITORY set to United Arab Emirates have Saturday with day number equals to 1. 
So to change the day order of the week which depends on NLS_TERRITORY DB parameter, rather than changing every client machine, you could do the following:

Create a Database trigger in which it firs after user login to database, and then overwrite the NLS_TERRITORY parameter to AMERICA in which Sunday corresponds to 1 as day number of the week.

Change the NLS_LANG in regedit to ARABIC_AMERICA ARMSWIN1256 for forms6i users.

This is was tricky fast solution rather than opening all forms to modify day of the week calculation that developers did ....!!!!!!