Getting record count from each tables from tab view
JCFeb 26 2007 — edited Feb 26 2007Hi
I just want to get no. of records in each table .
Probably it could be possible through single query, I just wrote following code...but I get some error....
**********************
1 declare
2 cursor c1 is select tname from tab where tabtype = 'TABLE' ;
3 tabname varchar2(1000) ;
4 i number := 1;
5 rc number ;
6 str varchar2(1000) ;
7 begin
8 open c1 ;
9 loop
10 fetch c1 into tabname ;
11 exit when c1%notfound ;
12 str := 'select count(*) into ' || rc || ' from ' || tabname || ' ; ' ;
13 execute immediate str ;
14 dbms_output.put_line(i || ' - ' || tabname || ' -- ' ||rc) ;
15 i := i + 1 ;
16 end loop ;
17 close c1 ;
18* end ;
**********************
Error is :-
declare
*
ERROR at line 1:
ORA-00936: missing expression
ORA-06512: at line 13
I have doubt whether we can use user cursor returned values in Execute immediate ...
can anyone here check this
Thanks in advance
JC