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 -> Re: PL/SQL: variable column & table name in select

Re: PL/SQL: variable column & table name in select

From: <sybrandb_at_my-deja.com>
Date: Thu, 11 Jan 2001 09:08:58 GMT
Message-ID: <93jt76$k6q$1@nnrp1.deja.com>

In article <93jngj$j0o$1_at_alpha.main.vsu.ru>,   "Viatcheslav V. Kopeikin" <kvv_at_main.vsu.ru> wrote:
> Hi, All!
> Help me please, I've broken my head on this problem :). The situation
 is as
> follows: I need making a procedure on PL/SQL to get the max number
 of the
> first column in any table (of course if this column is numeric). How
 can I
> say in SELECT "first column in any table"? The procedure looks
 something
> alike:
> procedure max_number (table_name varchar2,
> maxnum number) is
> begin
> select max([What here?]) into maxnum from [What here?];
> dbms_output.enable;
> dbms_output.put_line('maxnum='||to_char(maxnum));
> end max_number;
>
> WBR, Viatcheslav.
>
>

In Oracle 7 and Oracle 8.0, you need to use dbms_sql to accomplish this. In Oracle 8i you can use Native Dynamic SQL. If you want a more specific answer, please post which version you are using.

Hth,

--
Sybrand Bakker, Oracle DBA

All standard disclaimers apply
------------------------------------------------------------------------


Sent via Deja.com
http://www.deja.com/
Received on Thu Jan 11 2001 - 03:08:58 CST

Original text of this message

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