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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Procedure Problem

Re: Oracle Procedure Problem

From: amogh <amogh.r_at_gmail.com>
Date: Fri, 21 Apr 2006 18:50:47 +0530
Message-ID: <1g52g.22$h8.139@news.oracle.com>


Kuldeep wrote:
> create procedure tab_rows
> IS
> tab_name varchar(50);
> declare cursor all_tabs is
> select table_name
> from user_tables;
> begin
> create table temptab (rowc number (10));
> open all_tabs;
> Loop
> fetch all_tabs into tab_name;
> insert into temptab(rowc) select
> count(*) from tab_name;
> exit when all_tabs%notfound;
> End loop;
> close all_tabs;
> End;
>
> temptab has only one column rowc(number)
>
> Objective : ; procedure will return count(*) of all user tables.
>
> But above procedure is giving Error :Procedure created with compilation
> errors.
>
> Can anybody has workaround over it
>

There are both syntactic and logical errors. The most obvious is the "create table" call. You cannot execute a DDL inside a PL/SQL block with a direct "create .." call. Try using "execute immediate" instead.

Type "sho err" on the SQL prompt to see the errors.

Rgds
Amogh Received on Fri Apr 21 2006 - 08:20:47 CDT

Original text of this message

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