Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL Problem
See below
Klaus
<bombart_at_my-deja.com> schrieb im Newsbeitrag
news:8o2fnl$l9a$1_at_nnrp1.deja.com...
> Hello,
>
> I need your help.
>
> I'd like to write a program, which countts the ata record of a table.
> The result of prog1 should be used in prog 2.
>
> create or replace procedure TabSaetze (TABNAM VARCHAR2) is
> anz number(6);
> begin
Here you have to use either dbms_sql package to generate that statement at runtime or (with 8.1.x) native dynamic sql, e.g.: execute immediate 'select count(*) from ' || tabnam into anz;
> select count(*) into anz from TabNam
> DBMS_OUTPUT.pUT_LINE (TabNam||tochar(anz,'999.999');
> end;
>
> create or replace procedure TabName is
> coursor cu is
> select TNAME from tab;
> TabNam tab.Tname %type;
> begin
> open cu;
> loop
> fech cu into TabNam;
> exit when cu%notfound;
> TABSAETZE (TABNAM);
> end loop;
> end;
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Aug 24 2000 - 03:32:34 CDT