Query Help
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Query Help

  1. #1
    Join Date
    Feb 2001
    Posts
    125
    Can anybody help me.

    I want to get table_names and number of rows in table
    for a user.

    output should be like this

    table_name number_of_rows
    -------------- ------------------
    Dept 5
    Emp 10
    ...
    ...
    ...
    ...


    note : I want to get it by single query

    thnx in adv.
    P. Soni

  2. #2
    Join Date
    Jul 2000
    Posts
    296
    If the tables are (recently) analyzed:
    SELECT table_name, num_rows FROM user_tables;

  3. #3
    Join Date
    Jul 2000
    Location
    india
    Posts
    213
    Hi Akkerend
    How do i analyze a particular table cause when i run the above query i always get the NUM_ROWS as blank.pls give the syntax.
    thanks in advance
    pras

  4. #4
    Join Date
    Feb 2001
    Posts
    184

    Angry

    Here is a Query.
    If you want to analyze a particular table use this
    Analyze table Table_name compute statistics;
    If you want to analyze all the tables just do this
    spool analyze.sql
    select 'analyze table '||table_name||' compute statistics ;'
    from user_tables;
    spool off
    @analyze.sql

    Now You can run this
    SELECT table_name, num_rows FROM user_tables;
    It will give the table name and number of rows there.

    Any Question, feel free.
    Thanks

  5. #5
    Join Date
    Jul 2000
    Location
    india
    Posts
    213

    Thumbs up

    Hi Oracledba8
    thank you very much.now iam getting the num_rows.
    pras

  6. #6
    Join Date
    Feb 2001
    Posts
    125
    Thanks both for your kind help


    P. Soni

Posting Permissions

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


Click Here to Expand Forum to Full Width