Select from multiple tables

From: Martin Schneider <martin_at_tntsoftware.com>
Date: Thu, 13 Sep 2001 08:27:10 -0700
Message-ID: <3ba0d082_1_at_news.nwlink.com>



Hi,

[Quoted] I'm working with 8i (8.1.7.0.0) and SQL*Plus Worksheet on Win2000, and am [Quoted] monitoring several tables in a database. I would like to be able to select [Quoted] a few rows from each table without having to edit and re-run my query. I [Quoted] tried the procedure below but without success (I couldn't figure out how to [Quoted] declare the identifier...). Can you tell me if I'm on the right track? Way [Quoted] off-base? Should I approach the problem differently?

Thank you,
Martin

--------Procedure Below-----------

DECLARE
 PROCEDURE getLines(theTable IN VARCHAR2) IS BEGIN
 select * from "SCOTT"."theTable" WHERE ROWNUM < 5; END getLines;
BEGIN
 getLines("EMP");
 getLines("SALGRADE");
END;
/
--------Procedure Above-----------

--------Error Messages Below-------

 select * from "SCOTT"."theTable" WHERE ROWNUM < 5;

               *
ERROR at line 4:

ORA-06550: line 4, column 16:
PLS-00201: identifier 'SCOTT.theTable' must be declared
ORA-06550: line 4, column 2:

PL/SQL: SQL Statement ignored
ORA-06550: line 7, column 11:
PLS-00201: identifier 'EMP' must be declared
ORA-06550: line 7, column 2:

PL/SQL: Statement ignored
ORA-06550: line 8, column 11:
PLS-00201: identifier 'SALGRADE' must be declared
ORA-06550: line 8, column 2:

PL/SQL: Statement ignored
--------Error Messages Above-------
Received on Thu Sep 13 2001 - 17:27:10 CEST

Original text of this message