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: PLSQL and variable Table Names

Re: PLSQL and variable Table Names

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Fri, 15 Jun 2001 18:02:30 +0200
Message-ID: <tikc8j6j3v6i99@beta-news.demon.nl>

"Annett Tempel" <annett.tempel_at_gmx.de> wrote in message news:9gd72i$ta0$1_at_news.nrw.net...
> Hi,
>
> I have a short question.
> I have to write a SQL-Statement where I count the records.
> thats no problem.
>
> Code:
> CURSOR zaehler_cursor (tab_xx VARCHAR2:=tabelle) IS
> SELECT COUNT(*)
> FROM tab_xx;
>
> you see that I'll give the tablename with a parameter.
> But there is a mistake and I dont know where?
> Can you help me?
>
> Thanks and sorry for my english
> Annett
>
>
>
>

You need to use dynamic sql.
This would involve using the dbms_sql package in Oracle 7 and 8.0 and opening a ref cursor with Native Dynamic Sql in 8i and beyond.

Hth,

Sybrand Bakker, Oracle DBA Received on Fri Jun 15 2001 - 11:02:30 CDT

Original text of this message

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