Re: Problem with a date in the query !! (small example)
- From: Oliver Stratmann <stratmo@xxxxxxxxxxxx>
- Date: Tue, 27 Dec 2005 11:43:51 +0100
Hi Gab!
A small Example for you! I hope it helps.
<SQL>
-- creating "some" Dates
CREATE OR REPLACE VIEW dat_test_vw
AS
SELECT TO_DATE (20040101,'yyyymmdd') + id datum
FROM (
SELECT LEVEL id
FROM dual a
where 1=1
CONNECT BY LEVEL <= 10000
);-- selecting the intended period of time
SELECT a.*
FROM dat_test_vw a
,(SELECT to_date(TO_char(sysdate,'yyyy') || '0401','yyyymmdd') reference_date FROM dual) ref_dat
WHERE 1=1
AND ref_dat.reference_date <= a.datum
AND a.datum <= add_months(ref_dat.reference_date, +12) -1;
</SQL>
Merry Christmas and a happy new Year!
Bye! Oli .
- References:
- Problem with a date in the query !!
- From: gab
- Re: Problem with a date in the query !!
- From: Michel Cadot
- Re: Problem with a date in the query !!
- From: gab
- Problem with a date in the query !!
- Prev by Date: Re: Distinct not working when convert DATE using TO_CHAR
- Next by Date: Re: put away characters in result of query
- Previous by thread: Re: Problem with a date in the query !!
- Next by thread: Re: Problem with a date in the query !!
- Index(es):