Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a table to a procedure as a variable

Status
Not open for further replies.

billycairn

Technical User
Nov 5, 2003
22
GB
Hi

I have a web application which pulls images from a table and displays the results in a web page - works fine. I want to be able to pass the table name to the procedure at runtime - user clicks on a form option and the option populates the value for the table name which is used in the cursor which loops through the table. Can anyone advise me on the syntax. Or an alternative method. Code is below.
OS - Windows for development, Solaris for the live db.
Oracle 10g 1.0.2

---------code-------------
CREATE OR REPLACE procedure display_pdf_list_asTable
is
--create a cursor of the pdfs in the table
CURSOR pdf_cur
is
select * from <hard coded table name>;

pdf_rec pdf_cur%ROWTYPE;

BEGIN

-- htlm stuff to set up page

OPEN pdf_cur;
LOOP
FETCH pdf_cur into pdf_rec;
EXIT when pdf_cur%notfound;

-- generate more html for the page based on the table

END LOOP;
CLOSE pdf_cur;
END;

-------------end code--------------

It's the hard coded table name I want to pass at runtime. Any advice?

Cheers

BC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top