Quantcast
Channel: Grassroots Oracle
Viewing all articles
Browse latest Browse all 405

SQL tip: List days of the week

$
0
0
This one's real quick - something handy for later.

I've done some similar before for all days/weekends of the year, or the ubiquitous months of the year.

Here I wanted to dynamically define days of the week:
WITH data AS 
(SELECT NEXT_DAY(sysdate, 'MON') dt
FROM dual
CONNECT BY LEVEL <= 7)
SELECT TO_CHAR(dt+ROWNUM-1,'DY'), TO_CHAR(dt+ROWNUM-1,'Day')
FROM data;
Scott

Viewing all articles
Browse latest Browse all 405

Latest Images

Trending Articles



Latest Images