Home » SQL & PL/SQL » SQL & PL/SQL » How do I Submit a Table Name as a Parameter to a Procedure for Processing?
How do I Submit a Table Name as a Parameter to a Procedure for Processing? [message #3445] Fri, 27 September 2002 06:13 Go to next message
Lloyd M. Terrell
Messages: 5
Registered: September 2002
Junior Member
How do I submit a table name as a parameter to a procedure? I have to develope PL/SQL code to process a number of tables. The only thing that changes are the table names. I need to do something as follows:
CREATE OR REPLACE PROCEDURE DO_SMTHG(table_name IN VARCHAR2)
BEGIN
...
UPDATE table_name
...
END;

Would I have to do something like:
UPDATE &table_name

in order to use the table name within the code?

The script I will be using to execute this procedure will look something like this (VMS System - This job will be scheduled to run over night):

SQLPLUS SCOTT/TIGER@MADDEV.WORD EXECUTE DO_SMTHG('DEPT');
SQLPLUS SCOTT/TIGER@MADDEV.WORD EXECUTE DO_SMTHG('EMP');
SQLPLUS SCOTT/TIGER@MADDEV.WORD EXECUTE DO_SMTHG('BONUS');
...

Thanks.
Re: How do I Submit a Table Name as a Parameter to a Procedure for Processing? [message #3448 is a reply to message #3445] Fri, 27 September 2002 09:16 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
http://www.orafaq.net/msgboard/plsql/messages/10661.htm
Previous Topic: Update table
Next Topic: date format
Goto Forum:
  


Current Time: Sun Apr 28 20:06:16 CDT 2024