Function for days

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
Post Reply
User avatar
rcruz
Rank: Programador Pleno
Rank: Programador Pleno
Posts: 32
Joined: Tue, 04 Jan 2005 10:52 am
Location: Candido Mota

Good morning everybody. I have a problem and I'm sure someone can help me because this forum is the maximum. Do I need a function or another routine that tells me if an informed date is or not working day ???
valeu Galera: -The: -O
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Take a look at this link: http://en.glufke.net/oracle/viewtopic.php?t=22
You can use to_char to find out the day of the week. (1 = Sunday, 7 = Saturday).
See example:

Select all

SQL> select to_char(sysdate, 'd') from dual; 
 
T 
- 
2 
 
SQL>  
SQL> select case when to_char(sysdate, 'd') in (1,7) then 'FIM DE SEMANA' 
  2              else 'DIA UTIL' 
  3         end 
  4  from dual; 
 
CASEWHENTO_CH 
------------- 
DIA UTIL 
 
SQL>  
SQL> select case when to_char(sysdate+5, 'd') in (1,7) then 'FIM DE SEMANA' 
  2              else 'DIA UTIL' 
  3         end 
  4  from dual; 
 
CASEWHENTO_CH 
------------- 
FIM DE SEMANA 
 
SQL>  
User avatar
rcruz
Rank: Programador Pleno
Rank: Programador Pleno
Posts: 32
Joined: Tue, 04 Jan 2005 10:52 am
Location: Candido Mota

Thanks huh .... I'm doing it right and for the holidays I created a table and a form where they register them and I kill my problem.
This forum is the bixo. :-O
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests