Home » SQL & PL/SQL » SQL & PL/SQL » pls
pls [message #187652] Mon, 14 August 2006 16:05 Go to next message
rnallamo
Messages: 24
Registered: August 2005
Junior Member
Can anyone tell how to find out weekend dates of a month
what is the saturday and sundays date. using sysdate
Re: pls [message #187657 is a reply to message #187652] Mon, 14 August 2006 16:59 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Would this example help?
SELECT 
  TRUNC(SYSDATE + LEVEL) date_column, 
  TO_CHAR(TRUNC(SYSDATE + LEVEL), 'D') date_number,
  TO_CHAR(TRUNC(SYSDATE + LEVEL), 'Day') date_name
FROM dual
CONNECT BY LEVEL < 10;
Re: pls [message #187660 is a reply to message #187652] Mon, 14 August 2006 17:11 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
SQL> SELECT t.dt, TRIM (TO_CHAR (t.dt, 'DAY')) "DAY"
  2     FROM (SELECT trunc(sysdate,'mm') + ROWNUM dt
  3                  FROM DUAL
  4            CONNECT BY LEVEL <= ceil(last_day(sysdate)-trunc(sysdate,'mm')) ) t
  5     WHERE TRIM (TO_CHAR (t.dt, 'DAY')) in ('SATURDAY', 'SUNDAY');

DT        DAY
--------- ---------
05-AUG-06 SATURDAY
06-AUG-06 SUNDAY
12-AUG-06 SATURDAY
13-AUG-06 SUNDAY
19-AUG-06 SATURDAY
20-AUG-06 SUNDAY
26-AUG-06 SATURDAY
27-AUG-06 SUNDAY

8 rows selected.

[Updated on: Mon, 14 August 2006 17:13]

Report message to a moderator

Re: pls [message #187714 is a reply to message #187652] Tue, 15 August 2006 02:18 Go to previous message
orafaqer
Messages: 48
Registered: July 2006
Member
Do not forget that this is a NLS dependent code.
Previous Topic: SQL qry doubt ...
Next Topic: "ORA 3114 Not connected to oracle" error after an "ORA-00054: resource busy and acqui
Goto Forum:
  


Current Time: Thu Dec 08 20:37:11 CST 2016

Total time taken to generate the page: 0.13151 seconds