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

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL\SQL Question.

Re: PL\SQL Question.

From: John Koo <johnkoo_at_i-wave.net>
Date: Wed, 20 Jan 1999 14:06:04 +0000
Message-ID: <36A5E2CC.A9785D53@i-wave.net>


tim.mcconechy_at_runtime.dk wrote:

> This hould be easy. i just don't know how to do it.
> In a stored procedure I want to use the table as a parameter.
> How do I do it?
>
> Example.
> CREATE OR REPLACE PROCEDURE GETNEXTRECNO
>
> (
> field IN varchar2,
> table_name IN varchar2,
> nextrecno OUT integer
> )
>
> AS
> BEGIN
> /*gets next recno on a table*/
> select max(field) into nextrecno from table_name ;
>
> END;
>
> Above errors out on tablename and says. I need to select a table to which the
> user has access when I compile.
>
> How can I use table as a paraeter like this.
>
> Thanks
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

What you can do is to use dbms_sql. i.e. Dynamic SQL to construct the SQL statement
and then parse, execute and fetch at runtime. This is call late binding. Isn't it ??

John Koo
johnkoo_at_i-wave.net Received on Wed Jan 20 1999 - 08:06:04 CST

Original text of this message

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