Home » SQL & PL/SQL » SQL & PL/SQL » Populate Drop Down list with query results
icon5.gif  Populate Drop Down list with query results [message #220466] Tue, 20 February 2007 15:26 Go to next message
mfredin
Messages: 4
Registered: February 2007
Location: Minnesota
Junior Member
I would like to use PL/SQL to query a table and populate a dropdown box with the results. Very simple. I'm sorry I am very new to PL/SQL and can't find my answer anywhere. Thanks for your time.
Re: Populate Drop Down list with query results [message #220468 is a reply to message #220466] Tue, 20 February 2007 15:36 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
PL/SQL runs inside the database engine.
Exactly where does this "pull down menu" exist/reside?
Re: Populate Drop Down list with query results [message #220470 is a reply to message #220468] Tue, 20 February 2007 15:43 Go to previous messageGo to next message
mfredin
Messages: 4
Registered: February 2007
Location: Minnesota
Junior Member
Thanks for the quick response. Well I am using a dynamic page portlet inside Oracle Portal 10.1.4.0. It allows me a combination of HTML and PL/SQL. The PL/SQL must reside between the <ORACLE></ORACLE> tags inside the HTML.
Re: Populate Drop Down list with query results [message #220472 is a reply to message #220466] Tue, 20 February 2007 15:45 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
The PL/SQL Reference manual can be found at http://tahiti.oracle.com
many, many fine coding examples can be found at http://asktom.oracle.com
Re: Populate Drop Down list with query results [message #220474 is a reply to message #220472] Tue, 20 February 2007 15:55 Go to previous messageGo to next message
mfredin
Messages: 4
Registered: February 2007
Location: Minnesota
Junior Member
I understand you can't just be writing everyones code for them but I just know nothing about PL/SQL and don't have the time to learn a new language for a dynamic drop down. I can't find any code examples that are specific enough to a drop down that I can really understand whats happening and what I need to do to make it work.
Re: Populate Drop Down list with query results [message #220507 is a reply to message #220474] Wed, 21 February 2007 00:40 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Ask a peer at your shop.
Would you alter a java page without ANY knowledge of java? Would you change an assembler program without ANY knowledge of assembler-language?
Then why would you with a pl/sql program?
Re: Populate Drop Down list with query results [message #220668 is a reply to message #220507] Wed, 21 February 2007 09:18 Go to previous messageGo to next message
Ronald Beck
Messages: 121
Registered: February 2003
Senior Member
htp.p('<select name="dropdown">');

for info in (select a.value, a.text
             from myTable a )  loop
  htp.p('<option value="'||info.value||'">'||info.text);
end loop;

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



where a.value is the value you want in the SELECT options and a.text is what you want displayed as the dropdown text. myTable is the table that has the information you want to display in your dropdown.

I usually create pl/sql procedures and/or packages that output the entire HTML code for a page I'm creating. I then use the "Create Dynamic Page" in portal to execute the procedure. So, one of my dynamic pages looks like this...

<ORACLE>begin
  miscshipping.miscshipgen_request_form;
end;</ORACLE>



That is my ENTIRE html code for the dynamic page. The procedure referenced has all the html code to generate the complete form. I find this method easier to work with and much more flexible.

Hope this helps,
Ron
Re: Populate Drop Down list with query results [message #220698 is a reply to message #220668] Wed, 21 February 2007 10:38 Go to previous message
mfredin
Messages: 4
Registered: February 2007
Location: Minnesota
Junior Member
Ronald,

Thanks so much! It works great!

Sounds like you have experience with portal? I'm starting to see PL/SQL is going to be a main stay for what I'm trying to accomplish, and plan on learning it in the near future. Besides PL/SQL, is there anything else that would be a help to learn for portal dev? I'm just getting into this and trying to get my arms wrapped around the Oracle world.
Previous Topic: oracle tablespace
Next Topic: sqlplus on Windows sends parameter 1: '2>nul'
Goto Forum:
  


Current Time: Fri Dec 09 04:12:07 CST 2016

Total time taken to generate the page: 0.16383 seconds