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: Count records dynamically

Re: Count records dynamically

From: Matt B. <mcb_at_fightspam.sd.znet.com>
Date: 2000/09/21
Message-ID: <sslup0drna03ff@corp.supernews.com>#1/1

"Robert Vabo" <robert.vabo_at_gecko.no> wrote in message news:1g5t5.808$N4.283106_at_juliett.dax.net...
> I want to count number of records in a table using a cursor so I can use it
> on any table
>
> CURSOR CountRecs (TableName VARCHAR2)
> IS
> SELECT COUNT(*) FROM TableName;
>
> When I compile this I get an error message :
>
> PLS-00356: 'TABLENAME' must name a table to which the user has access
>
> Any suggestions on another method to do this ?
>
>
> --
> Regards
> Robert Vabo
> Application developer
> Gecko Informasjonssystemer AS
> www.gecko.no
> robert.vabo_at_gecko.no

Use dynamic SQL (see DBMS_SQL package) or just use an ampersand if the user is doing this through SQL*Plus and it's appropriate to prompt them (and you won't need your variable declared either in this case).

-Matt Received on Thu Sep 21 2000 - 00:00:00 CDT

Original text of this message

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