Populate Drop Down list with query results [message #220466] |
Tue, 20 February 2007 15:26 |
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 #220470 is a reply to message #220468] |
Tue, 20 February 2007 15:43 |
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 #220474 is a reply to message #220472] |
Tue, 20 February 2007 15:55 |
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 #220668 is a reply to message #220507] |
Wed, 21 February 2007 09:18 |
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 |
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.
|
|
|