Re: Select from multiple tables

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 13 Sep 2001 17:58:44 +0200
Message-ID: <tq1mb8maj36q4d_at_news.demon.nl>


[Quoted] "Martin Schneider" <martin_at_tntsoftware.com> wrote in message news:3ba0d082_1_at_news.nwlink.com...
> Hi,
>
> I'm working with 8i (8.1.7.0.0) and SQL*Plus Worksheet on Win2000, and am
> monitoring several tables in a database. I would like to be able to
select
> a few rows from each table without having to edit and re-run my query. I
> tried the procedure below but without success (I couldn't figure out how
to
> declare the identifier...). Can you tell me if I'm on the right track?
Way
> 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-------
>
>
>

Try to read a PL/SQL manual.
You'll need 'dynamic sql' and 'resultsets'

A both these questions in this group have been answered at least a million times, I won't dwell on the details here.

Regards,

Sybrand Bakker, Senior Oracle DBA Received on Thu Sep 13 2001 - 17:58:44 CEST

Original text of this message