Question

Asked on 2005-04-14 at 06:20:54ID: 25472037

day of the week

by: balee125

Rating7.2Very Good

Oracle: 9i
O/S: UNIX
------------

I need to get the weekday for a given date. I have the following solution, but the problem is that the user will not have alter session right. Is there any other way around where I don't need to use that?

Weekday:
-----------
to_char(some_date,'D') returns a number indicating the weekday. However, for a given date, this number returned varies with NLS_TERRITORY:
SQL> alter session set nls_territory='UNITED KINGDOM';

Session altered.

SQL> select to_char(sysdate,'D') from dual

T
-
4

SQL> alter session set nls_territory='AMERICA';

Session altered.

SQL> select to_char(sysdate,'D') from dual;

T
-
5

I executed these select statements on a thursday. So, in America, Thursday seems to be the 5th day in the week while it is the 4th in the UK.

Thanks,
Balee

  1. enable trace on remote session
    for enabling trace in my current session -- i can use alter session set sql_trace = true ; if i want to enable trace on one remote session what is the command ??
  2. How do i run a pl/sql script in a sqlplus session.
    sqlplus -s << EOF >> /dev/null $db_login spool $logs_dir/tmp.log if to_char(sysdate,'DY') in ('SAT','SUN') then null; -- no activity needed on weekends. elsif to_char(sysdate,'DY') = 'MON' then --removing data inserted on previous week's thursday and before. …
  3. week of day problem
    hi guys, i am using to_number(to_char(sysdate,'D') ) to get the week of day but it runs depend on regional settings and if it is amrican it gives 2 and if it is english it gives 1 for monday. but i dont would like to be dependent on the regional settings. i would like to be independent. is there any function to return the week of day independent…
  4. Alter Session
    Can you tell me when and why "Alter session" gets triggered? I have a PHP/Oracle site where i dont use alter session. But still i see this getting triggered in database.
  5. Alter Session Priviledge Vs Public Synonym
    I've an application in two schema 'APP1' & 'APP2'. These two schemas are accessible by a number of users. Some of the user can only access schema 'APP1', some can only access schema 'APP2' and some users can access both. I've created necessary roles with different priviledge for these users. Since these users cannot directl…

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
day week oracle
Participating Experts
5
Solution Grade
B

Replies

 by: alexnuijten

Posted on 2005-04-14 at 06:24:48ID: 28309859

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: balee

Posted on 2005-04-14 at 06:39:40ID: 28309860

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: alexnuijten

Posted on 2005-04-14 at 06:49:16ID: 28309861

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: schwertner

Posted on 2005-04-14 at 07:05:18ID: 28309862

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: balee

Posted on 2005-04-14 at 07:17:42ID: 28309863

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: awking00

Posted on 2005-04-14 at 07:50:30ID: 28309864

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: awking00

Posted on 2005-04-14 at 07:53:29ID: 28309865

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: balee

Posted on 2005-04-14 at 08:05:53ID: 28309866

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: earthman2

Posted on 2005-04-14 at 10:07:45ID: 28309867

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by:

Posted on 2005-04-14 at 11:51:17ID: 28309868

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: earthman2

Posted on 2005-04-14 at 11:55:40ID: 28309869

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jrb1

Posted on 2005-04-14 at 11:57:25ID: 28309870

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: awking00

Posted on 2005-04-14 at 12:27:08ID: 28309871

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: awking00

Posted on 2005-04-14 at 12:41:17ID: 28309872

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: jrb1

Posted on 2005-04-14 at 13:07:36ID: 28309873

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: balee

Posted on 2005-04-14 at 23:51:59ID: 28309874

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert