Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: populating years in a drop down menu in PL/SQL
G Quesnel wrote:
> Here is some info that I think might help...
> The following query can be used to return a list of year (numbers) from
> 1980 to this year;
> Select 1979+rownum "MyYear"
> from all_objects
> where rownum < extract(YEAR from sysdate)-1979+1;
>
> The other thing this query does is to define the column name as
> "MyYear" (case sensitive when in double quotes, or all upper case when
> not in quotes).
> The only limitation is that the view all_objects has to return many
> rows (which it usually does).
>
> HTH
Alternatively you could use a pipelined table function similar to the
one in Morgan's Library at www.psoug.org that produces a range of dates.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Wed Aug 02 2006 - 12:10:35 CDT
![]() |
![]() |