Dynamic sql query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prashant

    Dynamic sql query

    Hi Folks,
    Can u help me out on a sql query:
    Requirement is i need to print
    table_name , columns_inside_ table , rows_in_this_ta ble of a particular
    schema..
    I have got 1 solution from using PLSQL , but i want to get the desired
    output with sql qurey only.
    I have partial solution of this:

    "select table_name "Table Name" , count(*) "Columns" from
    user_col_commen ts
    /*((or v can also use user_tab_column s))*/ group by table_name;

    This is giving me table_name and number of columns in this table but
    not rows..

    Can U guys help me on it..
    Thanx & regs in advance..
    Prashant Khanna.
  • Daniel Roy

    #2
    Re: Dynamic sql query

    To find out the number of rows in a table, use DBMS_STATS
    (.GATHER_SCHEMA _STATS or .GET_TABLE_STAT S) to analyze your tables (or
    your whole schema), and you can afterwards use column NUM_ROWS of
    table ALL_TABLES. Depending on which optimizer mode you use, you might
    want to delete these statistics afterwards (with
    DBMS_STATS.DELE TE_SCHEMA_STATS or DBMS_STATS.DELE TE_TABLE_STATS) .

    Daniel
    [color=blue]
    > Can u help me out on a sql query:
    > Requirement is i need to print
    > table_name , columns_inside_ table , rows_in_this_ta ble of a particular
    > schema..
    > I have got 1 solution from using PLSQL , but i want to get the desired
    > output with sql qurey only.
    > I have partial solution of this:
    >
    > "select table_name "Table Name" , count(*) "Columns" from
    > user_col_commen ts
    > /*((or v can also use user_tab_column s))*/ group by table_name;
    >
    > This is giving me table_name and number of columns in this table but
    > not rows..
    >
    > Can U guys help me on it..
    > Thanx & regs in advance..
    > Prashant Khanna.[/color]

    Comment

    Working...