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: populating years in a drop down menu in PL/SQL

Re: populating years in a drop down menu in PL/SQL

From: <happyardy_at_gmail.com>
Date: 2 Aug 2006 10:54:48 -0700
Message-ID: <1154541288.601602.44850@m79g2000cwm.googlegroups.com>

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
Thanks a lot for your answer. For some reason I cannot get it to work when I use it in my FormSelectOption.

CURSOR inst_years IS
  Select 1979+rownum "MyYear"
  from all_objects
  where rownum < extract(YEAR from sysdate)-1979+1;

htp.p('<TD>');

         htp.formSelectOpen('p_inst',NULL,'1');
         htp.formSelectOption('Not listed',NULL,'VALUE=XX');

         FOR year_rec IN inst_years LOOP
             htp.formSelectOption(year_rec.MyYear,NULL,
                               'VALUE=' || year_rec.MyYear);
         END LOOP;

         htp.p('</TD>');

It doesnt work when I do that. If I comment out the "For loop", it doesnt give me an error atleast. Would you know what is wrong ?

Received on Wed Aug 02 2006 - 12:54:48 CDT

Original text of this message

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