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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: sql question

Re: sql question

From: Michael Twaddell <twaddell_at_Raytheon.com>
Date: Thu, 20 Apr 2006 16:02:23 -0500
Message-ID: <4447F6DF.8090906@raytheon.com>


Chris,

This may not be the most efficient method, but it should do what you want as long as user_objects contains at least (current year - 1994) rows.

SELECT 1994 + rn

   FROM (SELECT row_number() over (order by object_name) rn

           FROM user_objects
          WHERE rownum <= 30)

  WHERE 1994 + rn <= TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY'))

Michael T.

Chris Stephens wrote:
> Can anyone think of a way to generate a list of years from say 1995 to
> the current year in straight sql?
>
>
> chris
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Apr 20 2006 - 16:02:23 CDT

Original text of this message

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