Home » SQL & PL/SQL » SQL & PL/SQL » No .of rows in a table (Oracle 10g)
No .of rows in a table [message #404717] Sat, 23 May 2009 00:54 Go to next message
ramesh55.sse
Messages: 262
Registered: December 2008
Location: Hyderabad
Senior Member
Please assist for the following query
I want to no.of rows in a table without using COUNT,
for that i have writtten the following query

SQL>select num_rows
from user_tables
where table_name='EMP';

NUM_ROWS
----------
13
If i use the same query for DEPT table it showing the following result,
even if the DEPT table has 4 rows
SQL>select num_rows
from user_tables
where table_name='DEPT';

NUM_ROWS
----------
Re: No .of rows in a table [message #404720 is a reply to message #404717] Sat, 23 May 2009 01:02 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
You could have searched the forum before posting.

By
Vamsi
Re: No .of rows in a table [message #404838 is a reply to message #404717] Sun, 24 May 2009 23:10 Go to previous messageGo to next message
ashoka_bl
Messages: 398
Registered: November 2006
Location: Bangalore
Senior Member

Did you really bothered to check whether USER_TABLES has records for table_name DEPT,

FYI, i executed your query and got the desired results Smile
Re: No .of rows in a table [message #404843 is a reply to message #404717] Sun, 24 May 2009 23:14 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Still not able to read the documentation?
Still not able to search?
Still not able to follow guidelines?

Regards
Michel
Re: No .of rows in a table [message #404857 is a reply to message #404838] Mon, 25 May 2009 01:06 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
ashoka_bl wrote on Mon, 25 May 2009 06:10
Did you really bothered to check whether USER_TABLES has records for table_name DEPT,


Are you not able to see the difference between a null value and an empty resultset?
Search the docs what num_rows is for and how it gets its value. Then you'll understand why it is null.
Re: No .of rows in a table [message #404859 is a reply to message #404717] Mon, 25 May 2009 01:15 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
ramesh55.sse wrote on Sat, 23 May 2009 07:54
Please assist for the following query

@ramesh55.sse

You now posted 73 questions, and each time you come to the forum you just vomit out another batch of questions. You have responded exactly ONCE to all the replies you have received.
Practically all questions you ask are very very basic, and the answers are quite easy to find, either through google or from the documentation you were given links to over and over.
I think it is time to be more professional and start responding to the replies you receive, as well as showing that you made some efforts yourself before puking all your problems here.

[Updated on: Mon, 25 May 2009 01:16]

Report message to a moderator

Re: No .of rows in a table [message #404941 is a reply to message #404717] Mon, 25 May 2009 10:09 Go to previous message
prachij593
Messages: 266
Registered: May 2009
Senior Member
if i am not wrong num_rows (= select COUNT(*) from table1) when statistics are up to date.
Previous Topic: Error: ORA-00933 SQL command not properly ended (merged 3)
Next Topic: External tables unable to load special chars from csv file
Goto Forum:
  


Current Time: Sun Dec 04 00:34:18 CST 2016

Total time taken to generate the page: 0.07706 seconds