Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Challenge ! Find a query doing...

Re: Challenge ! Find a query doing...

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Mon, 3 Sep 2001 15:57:00 +0200
Message-ID: <9n027d$mi1$1@s1.read.news.oleane.net>


"Laurence TERRAS" <laurence.terras_at_digitech.fr> a écrit dans le message news: 9n00k1$7go$1_at_d03.completel.fr...
> sorry .... for this mistake
>
> the end of the challenge...
> So, the query would be able to give meYears and Months between 2 dates.
> (with dual table or I don't know ....)
>
> D1 = '22/09/2001' (DD/MM/YYYY)
> D2 = '15/05/2002' (DD/MM/YYYY)
>
> I'd like to get
>
>
> YYYY MM
> ------------------
> 2001 09
> 2001 10
> 2001 11
> 2001 12
> 2002 01
> 2002 02
> 2002 03
> 2002 04
> 2002 05
>
> Thanks and sorry for this horrible english...
>
> Laurence
>
>
> "Laurence TERRAS" <laurence.terras_at_digitech.fr> a écrit dans le message
> news: 9n0026$79j$1_at_d03.completel.fr...
> > Hello !
> >
> >
> > I'd like to fing a query wich be able to give Years and Months between 2
> > dates.
> > For example.
> > D1 = '22/09/2001' (DD/MM/YYYY)
> > D2 = '15/05/2002' (DD/MM/YYYY)
> >
> > results...
> >
> >
> >

v815> select to_char(add_months(trunc(to_date('22/09/2001','DD/MM/YYYY'),

  2                                  'MONTH'),
  3                            rownum-1),
  4                 'YYYY MM') "YYYY MM"
  5 from all_objects
  6 where rownum <= trunc(months_between(to_date('15/05/2002','DD/MM/YYYY'),
  7                                       trunc(to_date('22/09/2001','DD/MM/YYYY'),
  8                                             'MONTH')
  9                                       ))+1
 10 /

YYYY MM



2001 09
2001 10
2001 11
2001 12
2002 01
2002 02
2002 03
2002 04
2002 05

9 rows selected.

--
Regards
Michel
Received on Mon Sep 03 2001 - 08:57:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US