Catch the next SUNDAY

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc

Poston Thu, 11 Nov 2004 11:01 am

I was wondering how do you get say next Sunday or next Monday?

Location: Novo Hamburgo - RS

Poston Thu, 11 Nov 2004 11:05 am

Can use the following:
Code: Select all
select next_day(sysdate,'MONDAY')
from dual;
but then has the NLS_LANG problem, which can be set different ...
The best is to use the following:
Code: Select all
select trunc(sysdate + 1) + mod(abs(to_number(to_char(sysdate + 1,'D')) - 7) + 2, 7)
from dual;
Then you replace the 2 ...
(type 1 is Sunday, 2 is Monday, 3 Tuesday etc.)
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?

  • See also
    Last Post

    Return to PL/SQL

    Who is online

    Users browsing this forum: Google [Bot], Google Adsense [Bot] and 11 guests