pl/sql: determining table names at runtime?

From: Christian Bantzer <bantzerc_at_orca.akctr.noaa.gov>
Date: 1998/02/17
Message-ID: <Pine.SGI.3.95.980217150508.27744A-100000_at_orca.akctr.noaa.gov>#1/1


Hi,

[Quoted] I would like to write a procedure which selects from a table which's name will be determined only at runtime. So I tried something along these lines:

PROCEDURE dummy
IS
DECLARE
table_name varchar2(30);
BEGIN
table_name := will be set at runtime;
SELECT bla
INTO blub
FROM table_name;
END This does not work, because it doesn't treat table_name as a variable in the FROM line, but instead is trying to select from table TABLE_NAME, which most likely doesn't exist.
Do you have any idea if it's possible to tell pl/SQL to evaluate the variable in the FROM line?

Any feedback much appreciated

Thanks
Christian


Christian Bantzer                                   PSMFC-PacFIN F/AKC
christian_bantzer_at_psmfc.org                         Bldg. 4 Rm. 2066   
phone (206) 526 4057                                7600 SandPoint Wy. NE
fax   (206) 526 4074                                Seattle, WA 98115-0070
Received on Tue Feb 17 1998 - 00:00:00 CET

Original text of this message