Results 1 to 7 of 7

Thread: Number of lines

  1. #1
    Join Date
    Mar 2005
    Posts
    25

    Unanswered: Number of lines

    Hi

    How can I get the number of lines/registers in a table, without making: select count(*) from table

    Regards

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You could take the total weight of the table and divide that number by the average weight of a single row.
    The resultant number will be the number of rows in the table.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    May 2004
    Location
    BA [ARG]
    Posts
    137
    Quote Originally Posted by anacedent
    You could take the total weight of the table and divide that number by the average weight of a single row.
    The resultant number will be the number of rows in the table.
    Let me add, you'll need to maintain statistics for that.

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Quote Originally Posted by anacedent
    You could take the total weight of the table and divide that number by the average weight of a single row.
    The resultant number will be the number of rows in the table.
    LOL....

    In otherwords, how the heck is oracle supposed to know how many rows if you have never scanned the table. You can do statistics on the table and get close to the number of rows or you perform a count or you can dump the table, there is no other way.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  5. #5
    Join Date
    May 2004
    Location
    BA [ARG]
    Posts
    137
    What's the real question behind this?

  6. #6
    Join Date
    Mar 2005
    Posts
    25
    When quering a table, it has the field num_rows but it empty when I try to get the value.

  7. #7
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >it has the field num_rows but it empty when I try to get the value.
    Yes, this is normal & expected behavior.
    All fields start out empty until data is inserted/updated into the field.
    Oracle can not mind read & automagically update fields with "correct" values.
    Simply put, if you want to really know the number of rows in TABLE_A, then
    SELECT COUNT(*) FROM TABLE_A;
    Why are you reluctant to do so?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •