Home » SQL & PL/SQL » SQL & PL/SQL » num_rows blank (11g)
num_rows blank [message #603250] Thu, 12 December 2013 09:51 Go to next message
jbm417
Messages: 9
Registered: June 2012
Junior Member
Need help to understand & fix this problem.

If I run --> Select * from AM <-- I get 24 rows with data

If I run --> Select table_name, num_rows from user_tables <-- I get the expected results EXCEPT that table AM has a blank entry for num_rows.

TIA for any help, Joe

[Updated on: Thu, 12 December 2013 09:52]

Report message to a moderator

Re: num_rows blank [message #603251 is a reply to message #603250] Thu, 12 December 2013 09:59 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
jbm417 wrote on Thu, 12 December 2013 07:51
Need help to understand & fix this problem.

If I run --> Select * from AM <-- I get 24 rows with data

If I run --> Select table_name, num_rows from user_tables <-- I get the expected results EXCEPT that table AM has a blank entry for num_rows.

TIA for any help, Joe



statistics have not been collected for this table.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: num_rows blank [message #603252 is a reply to message #603250] Thu, 12 December 2013 09:59 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
That is populated when table statistics are gathered.
Re: num_rows blank [message #603253 is a reply to message #603252] Thu, 12 December 2013 10:00 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.oracle.com/pls/db121/search?word=dbms_stats
Re: num_rows blank [message #603297 is a reply to message #603250] Fri, 13 December 2013 03:30 Go to previous messageGo to next message
tigsav
Messages: 49
Registered: April 2012
Member
Hi ,

Adding an Example
SQL> DROP TABLE WITHOUT_STATS;
 
Table dropped
SQL> CREATE TABLE WITHOUT_STATS(id NUMBER,col1 VARCHAR2(255))
  2  /
 
Table created
SQL> BEGIN
  2  FOR v_indx IN 1..100 LOOP
  3  	INSERT INTO WITHOUT_STATS VALUES(v_indx,'Description for '||v_indx);
  4  END LOOP;
  5  COMMIT;
  6  END;
  7  /
 
PL/SQL procedure successfully completed
SQL> SELECT TABLE_NAME ,NUM_ROWS FROM ALL_TABLES WHERE TABLE_NAME ='WITHOUT_STATS';
 
TABLE_NAME                       NUM_ROWS
------------------------------ ----------
WITHOUT_STATS                  
SQL> BEGIN
  2  	DBMS_STATS.GATHER_TABLE_STATS(USER,'WITHOUT_STATS');
  3  END;
  4  /
 
PL/SQL procedure successfully completed
SQL> SELECT TABLE_NAME ,NUM_ROWS FROM ALL_TABLES WHERE TABLE_NAME ='WITHOUT_STATS';
 
TABLE_NAME                       NUM_ROWS
------------------------------ ----------
WITHOUT_STATS                         100
 
SQL> 

Re: num_rows blank [message #603341 is a reply to message #603297] Fri, 13 December 2013 09:44 Go to previous message
jbm417
Messages: 9
Registered: June 2012
Junior Member
Thanks for all the replies. The example helped to show how to use dbms_stats.

Previous Topic: Invalid characters, but have correct sql??
Next Topic: ORA-20120:ORA-01405:fetched column value is null
Goto Forum:
  


Current Time: Wed Apr 24 14:14:30 CDT 2024