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

Home -> Community -> Usenet -> c.d.o.server -> Re: Passing Table name as an argument

Re: Passing Table name as an argument

From: <hoyt_chen_at_my-dejanews.com>
Date: Wed, 14 Apr 1999 02:30:19 GMT
Message-ID: <7f0ujr$6e7$1@nnrp1.dejanews.com>


Hi there:

You did the wrong way!
The solution is: Using DBMS.SQL package to create a dynamic PL/SQL procedure. You can pass whatever you want, even a DDL statement, in a string.

Good Luck.

In article <7f0og3$1kd$1_at_nnrp1.dejanews.com>,   vragha_at_my-dejanews.com wrote:
> Hello!
>
> I want to pass a table name as an argument to a stored procedure? Is it
> possible at all or am I dreaming?
>
> Iwas trying it with a very simple stored procedure e.g
>
> #######################PL/SQL script#####################################
> create or replace procedure sp_test(table_name in varchar2(100))
> is
> test_num number;
> selecttable varchar2(100);
> begin
> select count(*) into test_num from table_name;
> end;
> #######################End PL/SQL script#####################################
>
> I tried out various combinations using this, but without luck. Can anybody
> suggest how to go about this.
>
> Thanks.
>
> --
> Vijay R
> vragha_at_my-dejanews.com
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Apr 13 1999 - 21:30:19 CDT

Original text of this message

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