Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Assigning a variable to a table name in FROM statement ???

Assigning a variable to a table name in FROM statement ???

From: Bernhard Acke <ba_at_metropolis.de>
Date: 09 Apr 2001 14:24:13 +0200
Message-ID: <3ad1a9f4$1@netnews.web.de>

I want to get the number of datasets from a different tables, where table names are stored in a separate table.

Is it possible to assign the table name dynamically in the FROM-Part of the SELECT-Statement (as a variable), so can do this with a loop.

I thought of something like this, but it doesnt work:

DECLARE

    actual_scheme_name          VARCHAR(30) := 'students';
    actual_table_name           VARCHAR(30) := 'adresses';
    number_of_datasets_entered  NUMBER(10) := 0;
BEGIN
    actual_table := actual_scheme_name || '.' || actual_table_name;     SELECT count (rowid)

        INTO number_of_datasets_entered
    FROM actual_table;



    DBMS_OUTPUT.PUT_LINE(number_of_datasets_entered); EXCEPTION
END; Any Ideas?

Thank you,

Bernhard

-- 
_____________________________________________________________
NewsGroups Suchen, lesen, schreiben mit http://netnews.web.de
Received on Mon Apr 09 2001 - 07:24:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US