Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Get consistent response from to_char 'D' using different NLS's

PericlesJul 26 2022

Hello
I'm using to_char(date,'D') in a package procedure to get the day of the week of a given date. If something happens on weekend (to_char(date,'D') is 1 or 7 ) the procedure should do A else B.
I'm facing some issues because the procedure will be called from an APEX 22.1 session affected by user's NLS. If the user's NLS is EN-US to_char('23-JUL-2022','D') returns 7, but if the user NLS is SP-AR then the same function returns 6, affecting the result of the procedure
I've found that DBMS_SESSION.SET_NLS can be used, but I'm quite worried about what would be the impact of that change for the end user.
Wonder if there is another way to find out if a date is Saturday or Sunday no mater NLS format.
Appreciate your comments.

This post has been answered by Frank Kulash on Jul 26 2022
Jump to Answer
Comments
Post Details
Added on Jul 26 2022
3 comments
71 views