List all the table names and no of records in DB.

Hi,
How can i write a select query which should give the total tables in the database and the number of records in each table.
Eg: I have 2 table in the database 1. EMP 2. DEPT . EMP table has 14 records and DEPT has 4 records. Then the out put should come like following.
TNAME RecCount
EMP 14
DEPT 4
Regards
Bond.

Also if Table statistics have been gathered(analyze table or DBMS_STATS) then this can also be used:
SQL> create table TEST_ABC
  2  (name_ABC varchar2(200));
Table created.
SQL> insert into TEST_ABC
  2  values('ABC');
1 row created.
SQL> insert into TEST_ABC
  2  values('DEF');
1 row created.
SQL> commit;
Commit complete.
SQL> select table_name, num_rows from all_tables where table_name = 'TEST_ABC';
TABLE_NAME                       NUM_ROWS
TEST_ABC
SQL> analyze table TEST_ABC compute statistics;
Table analyzed.
SQL> select table_name, num_rows from all_tables where table_name = 'TEST_ABC';
TABLE_NAME                       NUM_ROWS
TEST_ABC                                2
SQL>

Similar Messages

  • How can I list all the column names of a table by programming?

    Hi,
    Now I want to write an function which has the following features:
    Firstly, The function was given a parameter as table name.
    Then, it will lists all the columns names of the table.
    e.g
    table: person
    ---firstName------lastName----+
           Michale               Jackson
    We can get the columns 'firstname' and 'lastName' by calling the function with table name 'person'.
    And I also wonder that where I can get reference book or any other materials?
    Thanks.
    Edited by: wenjing wang on Feb 15, 2008 6:42 AM
    Edited by: wenjing wang on Feb 15, 2008 6:57 AM

    hi,
    hope the below code helps u. Just take the headee which contains the field name and split it like below and compare it with the field name u want here 'last name'.
    here,
    'First name' will be in wt_filedata1 and remaining field names in wt_filedata2, so 'do' continues.
    c_tab must be the separator, either , or + or tab etc..
    CODE:
    read table person into wl_header index 1.
    do.
        split wl_header at c_tab into: wt_filedata1 wt_filedata2.
        if wt_filedata1 <> 'lastname'.
          cnt1 = cnt1 + 1.
          wl_header = wt_filedata2.
        else.
          exit.
        endif.
      enddo.
    Please reward if it is useful.
    regards,
    sri

  • To Get all the Table Names

    Hi All
    I have nearly 70 procedures in my database.
    I want to get all the distinct table names used in the 70 procedures.
    Is it possible?
    Note:
    All the table names are prefixed by schema name like DEVSRC.table_name.
    Please advice
    Thanks
    Jo

    Johney  wrote:
    Hi VT
    One doubt.
    This query will give the table names of only select stmt used in the procedure
    or
    List of table names that are with in any DML operations inside the procedure?
    Thanks
    JoIt will give all the table either used in select or in any DML..
    You can also check by creating a temp proc
    SQL> drop procedure proc_test;
    Procedure dropped.
    SQL> select name, referenced_name, dependency_type from user_dependencies
      2  where type = 'PROCEDURE' and referenced_type = 'TABLE' and name='PROC_TEST';
    no rows selected
    SQL> create or replace
      2  PROCEDURE proc_test
      3  IS
      4  v_ID    number;
      5  v_PRID  number;
      6  v_PRLID number;
      7  v_DATERECEIVED date;
      8  Cursor C1 is
      9  select * from table_c;
    10   BEGIN
    11   open c1;
    12     LOOP
    13      FETCH c1 INTO v_ID,v_PRID,v_PRLID,v_DATERECEIVED;
    14      EXIT WHEN c1%NOTFOUND;
    15      insert into table_b values(v_ID,v_PRID,v_PRLID,v_DATERECEIVED);
    16      Commit;
    17     END LOOP;
    18   CLOSE C1;
    19   END;
    20  /
    Procedure created.
    SQL> select name, referenced_name, dependency_type from user_dependencies
      2  where type = 'PROCEDURE' and referenced_type = 'TABLE' and name='PROC_TEST';
    NAME
    REFERENCED_NAME                                                  DEPE
    PROC_TEST
    TABLE_B                                                          HARD
    PROC_TEST
    TABLE_C                                                          HARD
    SQL> Regards
    Umesh

  • Select data from all the table names in the view

    Hi,
    "I have some tables with names T_SRI_MMYYYY in my database.
    I created a view ,Say "Summary_View" for all the table names
    with "T_SRI_%".
    Now i want to select data from all the tables in the view
    Summary_View.
    How can i do that ? Please throw some light on the same?
    Thanks and Regards
    Srinivas Chebolu

    Srinivas,
    There are a couple of things that I am unsure of here.
    Firstly, does your view definition say something like ...
    Select ...
    From "T_SRI_%"
    If so, it is not valid. Oracle won't allow this.
    The second thing is that your naming convention for the
    tables suggests to me that each table is the same except
    that they store data for different time periods. This would be
    a very bad design methodology. You should have a single
    table with an extra column to state what period is referred to,
    although you can partition it into segments for each period if
    appropriate.
    Apologies if i am misinterpreting your question, but perhaps
    you could post your view definition and table definitions
    here.

  • Query to find all the view name and their size in GB

    Hi,
    What is the query to find all the view name and their size in GB.I am aware of joining all_views and user_segments but this is not serving the purpose.is there any table i need to join to get the desired result
    Thanks

    You could of course be thinking of views as they are stored in other RDBMS' as some of them actually create the view as a table on the database with a copy of the data in it and maintain that data as the base tables are updated.
    As already mentioned, Oracle just stores the SQL of the View and executes that SQL when the view is queried.
    Alternatively, Oracle also has "materialized views" which are created as snapshots of the data and will have a size. This data is updated (refreshed) based on the parameters used when creating the materialized view which means that it will either be, commonly, when a commit is issued or when a refresh is explicitly requested (refresh on demand).

  • Is there a way to view all the table names in a certain schema?

    Is there a way to view all the table names in a certain schema?

    SELECT table_name FROM user_tablesThat won't do much good given this piece of information:
    i am trying to finish a lab for school but i don't know what tables are in my
    professor's schema. The appropriate solution is
    SELECT table_name
    FROM all_tables
    WHERE owner = 'PROFESSOR_YAFFLE'
    /This will show the names of the tables which Prof. Yaffle has granted to us.
    Cheers, APC

  • Query to find out the table name and column name..

    Hi Experts,
    I have an Oracle DB in which has more than 50 tables and 100,000 records. I want to get the record which contains *"ITxtVarValue references a non existing text"* the text.
    Is there any query there to find out the table name and column name of this particular record where it reside?
    Please help. Any help will be rewarded.
    Thanks,
    G

    Using this forum's search function, I found a thread that should give you an idea: How to find out a tablename
    C.

  • I want to know the table name and field name of this description

    i want to know the table name and field names of this description
    supplieriddomain

    Hi SV,
    Try this:
    1) Go to SE15 (Repository info system)
    2) Expand ABAP Dictionary
    3) Expand Fields
    4) Click on Table Fields
    5) Enter the field name you want to search in field name or use wild cards with keywords in short decription field (like supplier ) and Execute.
    OR
    If it's a screen field, do a F1 on the field and click on Technical information on the help window popped up from Menu..this will tell you the field name along with structure or table name.
    Hope this helps you.
    Regards,
    Vivek

  • I want to know the table name and field names of this descriptions

    i want to know the table name and field names of this descriptions
    FPAApprover.UniqueName,FPAApprover.PasswordAdapter

    Hi Ramana,
    Go to the system table DD03T , use the table contents..
    In the field ' DDTEXT ' , give your keywords...
    for ex : say Unique name... as  UniqueName* in field DDTEXT
    Execute.. u will find the entries....
    May be ur problem will be solved...
    Thank u...
    Reward if useful and close the thread..
    Rajiv

  • Problem while displaying all the table names from a MS Access Data Source.

    I started preparing a small Database application. I want to display all the Table Names which are in the 'MS Access' Data Source.
    I started to executing by "Select * from Tab" as if in SQL.
    But i got an error saying that "Not able to resolve Symbol 'Tab' in the query".
    Please let me know how can i display all the table Names in the MS Access Dats Source.

    Here i am developing the application in Swing using JDBC for accessing the database.
    I want to display all the Table names from the data source in a ListBox for easy selection of tables to view their details.

  • Is there a way to list all the file names (automatically) in a folder to dynamic text box?

    Hi,
    I would like to know whether FLASH AS3 has some option to get all the files names from a folder specified and show it in a dynamic text box? Whenever some new files added to this folder it should update the list accordingly.
    Thanks for any information in this regard.

    Not particularly experienced in this field myself, but I've found its just easier to implement an XML file which lists the contents of the folder. It just means that when you upload a new file you have to add it to the list in the xml file also. No real hardship once you figure out the mechanics of it

  • How to get the table name and bind columns names in an INSERT statement ?

    I have an INSERT statement with input parameters (for example
    INSERT INTO my_table VALUES (:a, :a, :a)) and I want to know
    without parsing the statement which is the name of table to
    insert to and the corresponding columns.
    This is needed to generate the SELECT FOR UPDATE statement to
    refetch a BLOB before actually writing to it. The code does not
    know in advance the schema (generic code).
    Thanks in advance,
    Joseph Canedo

    Once you have prepared your statement, you can execute the
    statement with the OCI_DESCRIBE_ONLY mode before binding any
    columns. Then you can use OCIParamGet to find out about each
    column (column index is 1-based). You should get OCI_NO_DATA or
    ORA-24334 if there are no more columns in the statement. Note
    that the parameter descriptor from OCIParamGet is
    allocated/freed internally by OCI; you do not need to manage it
    explicitly. The parameter descriptor is passed to OCIAttrGet in
    order to obtain for instance the maximum size of data in the
    column OCI_ATTR_DATA_SIZE. You can also get the column name in
    this way, although I do not remember the #define off the top of
    my head. Getting the table name appears to be much more
    difficult; I have never had to do that yet. Good luck. -Ralph

  • Can we see all the Technical names and field/common names in one screen

    Hi SAP Gurus,
    Can any one plz. clearify the querry of 'all the technical names, field names, common names, table names in one screen? if so, how?
    Thanks inadvance
    Regards
    Namrata

    Hi,
    For a particular screen,if u want to see all the technical data,
    Go to system->status->screen->double click on the screen->flow logic.
    Regards,
    Manoj.

  • How can I use PowerShell 3.0 cmdlets or script to list all the local groups and local users of a server?

    Using PowerShell 3.0 (And if possible the CIM, not WMI cmdlet), how can I script with | out-file C:\<filename>.txt or .csv option to list all local user accounts & local groups
    on remote computers? 
    Thank You!

    I don't recall PowerShell V3 introducing anything new to handle local users and groups. You need to use PowerShell V1 methods, using the [ADSI] accelerator and the WinNT: provider. The scripts linked above show this. No need to use WMI (which would probably
    be slower).
    Here is a script I've used to enumerate all local groups and their members:
    $Computer
    = "MyServer"
    $Computer =
    [ADSI]"WinNT://$Computer"
    $Groups =
    $Computer.psbase.Children | Where {$_.psbase.schemaClassName
    -eq "group"}
    ForEach ($Group
    In $Groups)
        "Group: "
    + $Group.Name
        $Members
    = @($Group.psbase.Invoke("Members"))
        ForEach ($Member
    In $Members)
            $Class
    = $Member.GetType().InvokeMember("Class",
    'GetProperty', $Null,
    $Member, $Null)
            $Name
    = $Member.GetType().InvokeMember("Name",
    'GetProperty', $Null,
    $Member, $Null)
            "-- Member: $Name ($Class)"
    A similar script to enumerate all local users would be:
    $Computer
    = "MyServer"
    $Computer =
    [ADSI]"WinNT://$Computer"
    $Users =
    $Computer.psbase.Children | Where {$_.psbase.schemaClassName
    -eq "user"}
    ForEach ($User
    In $Users)
        "User: "
    + $User.Name
    Richard Mueller - MVP Directory Services

  • What is the table name and field name for Street 2, street3 in Vendor mast.

    Hi,
    I have a BDC code for Vendor master. I just need to insert the fields street 2, street3, stree4 and street5 in the code. Can I insert it in the code directly without re-recording? If yes then what would be the table and field names for the fields mentioned above.
    Thanks & Regards,
    Sriram

    Hi Sriram,
       Its a Configuration Setting to bring the Check box ask your SD consultant, else directly insert this try, change your internal table filed here,
      PERFORM bdc_dynpro USING 'SAPMF02K'    '0100'.
      PERFORM: bdc_field USING 'RF02K-BUKRS' indata-bukrs,
               bdc_field USING 'RF02K-EKORG' indata-ekorg,
               bdc_field USING 'RF02K-KTOKK' indata-ktokk,
               bdc_field USING 'USE_ZAV'     'X',------------------------>this part is check box
               bdc_field USING 'BDC_OKCODE'  '/00'.
    for street just try this without re-recording,
    PERFORM bdc_field  USING 'ADDR1_DATA-NAME1'       indata-name1.
      PERFORM bdc_field  USING 'ADDR1_DATA-NAME2'       indata-name2.
      PERFORM bdc_field  USING 'ADDR1_DATA-SORT1'       indata-sortl.
      PERFORM bdc_field  USING 'ADDR1_DATA-STREET'      indata-stras.
      PERFORM bdc_field  USING 'ADDR1_DATA-POST_CODE1'  indata-pstlz.
      PERFORM bdc_field  USING 'ADDR1_DATA-CITY1'       indata-ort01.
      PERFORM bdc_field  USING 'ADDR1_DATA-COUNTRY'     indata-land1.
      PERFORM bdc_field  USING 'ADDR1_DATA-REGION'      V_regio.
      PERFORM bdc_field  USING 'ADDR1_DATA-PO_BOX'      indata-pfach.
      PERFORM bdc_field  USING 'ADDR1_DATA-STR_SUPPL2'  indata-suppl2.
      PERFORM bdc_field  USING 'ADDR1_DATA-TAXJURCODE'  indata-txjcd.

Maybe you are looking for

  • How can I promote a field in my form to a SharePoint 2010 list column and have it populated?

    Hello,    I have created a form using some jquery, html and <td> tags. I would like to promote the fields that I am having users fill out in the form so that they appear in the list that the submitted form is writing to. Below is the code that I have

  • HP LaserJet 1018 not printing landscape on index cards

    I regularly print on 3 x 5 index cards with this printer.  In fact, this is the reason I purchased the printer.  Just this morning, I am suddenly unable to print landscape on it.  Any file set up in landscape will run through the printer and come out

  • Workitem is using data from old executed workitem.

    Hello. I have a workflow which has a step that will open transaction code PA40 for the user to update an infotype. Some fields will be already defaulted to some values and all the user has to do is to check the values in the fields and click on save.

  • Re: Realtek 8191SE card wont show up in device manager

    Satllite L450D-128 part number: PSLY5E-01301LEN, Win7 Ultimate 64 bit. Hi, I cannot use my wireless internet connection. The LAN connection works fine when connected via cable. I have read all the related topics to make sure i am not repeating a prev

  • NFS Version Mismatch?

    I have Redhat 6.0 PC running as a NFS server. Other Linux client can access it, but Solaris 2.6 workstations can not access it. However, this machine can mount the resource from Solaris 2.6 workstattion. Is it a NFS version mismatch problem? Redhat 6