Monday, February 18, 2013

Date Between and Date Range query



SELECT A.PAYROW_DATE A,A.PAYROW_DATE B FROM (
select DISTINCT LAST_DAY(TO_DATE('30/SEP/2007','DD/MON/RRRR') + level) PAYROW_DATE
 from dual connect by level < (TO_DATE('30/SEP/2012','DD/MON/YYYY') -----Change this Date
 - TO_DATE('30/SEP/2007','DD/MON/YYYY'))
 ORDER BY 1 DESC
 )A


SELECT A.PAYROW_DATE A,A.PAYROW_DATE B FROM (
 select DISTINCT LAST_DAY(to_date(:start_date,'dd-mon-yyyy') + rownum -1) PAYROW_DATE
     from all_objects
    where rownum <=
to_date(:end_date,'dd-mon-yyyy')-to_date(:start_date,'dd-mon-yyyy')+1
 ORDER BY 1 DESC
 )A

No comments:

Post a Comment

Best Blogger TipsGet Flower Effect