Skip to main content

Posts

Showing posts with the label How to select particular day date from given month in SQL

How to select particular day date from given month in SQL

How to select particular day date from given month in SQL. You can see below example to get some ideas. select dates,to(char(dates,'day-mon-yyyy') from (select to_date(:start_date,'dd-mon-yyyy')+rownum -1 as dates from all_objects where rownum<=to_date(:end_date,'dd-mon-yyyy')- to_date(:start_date,'dd-mon-yyyy')+1) where upper(regexp_substr(to_char(dates,'day-mon-yyyy'),'([[:alpha:]])+'))=upper(:day_name); 02-JUN-17 FRIDAY 09-JUN-17 FRIDAY 16-JUN-17 FRIDAY 23-JUN-17 FRIDAY 30-JUN-17 FRIDAY 07-JUL-17 FRIDAY 14-JUL-17 FRIDAY 21-JUL-17 FRIDAY 28-JUL-17 FRIDAY 04-AUG-17 FRIDAY 11-AUG-17 FRIDAY 18-AUG-17 FRIDAY 25-AUG-17 FRIDAY 01-SEP-17 FRIDAY