Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Tablename as a paramter
On 12 Oct 1998 16:05:27 GMT, NBronke_at_t-online.de (Nicolas Bronke)
wrote:
>Is it possible to place a tablename into the parameter list of a
>procedure/funtion?
Yes. If you use dynamic SQL.
eg.
create or replace
function getCount( tableName varchar2 ) return number is
n number; c number; s number;
'select count(*) from ' || tableName, dbms_sql.native );
>
>e.g.
>
>create function (tablename varchar2)
>return number
>as
> n number;
>begin
> select count(*) into n from tablename;
> return n;
>end;
>
>Kind regards
>Nicolas Bronke
>
Received on Mon Oct 12 1998 - 12:31:44 CDT