NUMBER OF RECORDS IN EACH TABLE???

Hi!
how can i find the number of records in each table in the database. the result should be like this
table_1 123
table_2 60
table_3 88
thanks!!
also if we want to see it only for a particular schema???

You can get all the table names and schemas from ALL_TABLES table.
then you can stored that on a cursor,
then you can create a function where you use an execute_immediate to run the queries dinamically. with that you can run a COUNT for each TABLE
That's the idea give it a shot :)
Regards

Similar Messages

  • SQL help: return number of records for each day of last month.

    Hi: I have records in the database with a field in the table which contains the Unix epoch time for each record. Letz say the Table name is ED and the field utime contains the Unix epoch time.
    Is there a way to get a count of number of records for each day of the last one month? Essentially I want a query which returns a list of count (number of records for each day) with the utime field containing the Unix epoch time. If a particular day does not have any records I want the query to return 0 for that day. I have no clue where to start. Would I need another table which has the list of days?
    Thanks
    Ray

    Peter: thanks. That helps but not completely.
    When I run the query to include only records for July using a statement such as following
    ============
    SELECT /*+ FIRST_ROWS */ COUNT(ED.UTIMESTAMP), TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD') AS DATA
    FROM EVENT_DATA ED
    WHERE AGENT_ID = 160
    AND (TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY')+(ED.UTIMESTAMP/86400)), 'MM/YYYY') = TO_CHAR(SYSDATE-15, 'MM/YYYY'))
    GROUP BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD')
    ORDER BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD');
    =============
    I get the following
    COUNT(ED.UTIMESTAMP) DATA
    1 07/20
    1 07/21
    1 07/24
    2 07/25
    2 07/27
    2 07/28
    2 07/29
    1 07/30
    2 07/31
    Some dates donot have any records and so no output. Is there a way to show the missing dates with a COUNT value = 0?
    Thanks
    Ray

  • Number of records in each partition

    Hi,
    Can any one please tell me, how to display number of record in each partion in any table.
    I wanted to use following in PL/SQL but it gives me error.
    Declare
    Cursor c1 is
    select partition_name into part_name from all_tab_partition where table_name = 'table_name';
    BEGIN
    for rec in c1
    Loop
    select count(*) into temp_var from table_name partition(rec.part_name)
    END LOOP;
    END;
    I guess I need dynamic SQL ..
    Any thoughts on this ??
    Thanks,
    Av

    It is always better to analyze the tables and get these details from num_rows as mentioned before but just in case you want the latest information from the table dynamically then use the following
    Declare
    Cursor c1 is
    select table_name,partition_name from all_tab_partitions where table_name = 'SALESDETAILS';
    v_sql varchar2(2000);
    temp_var number:=0;
    BEGIN
    for rec in c1
    Loop
    execute immediate 'select count(*) from '||rec.table_name||' partition('||rec.partition_name||')' into temp_var;
    dbms_output.put_line('The Partition '||rec.partition_name||' of table '||rec.table_name||' has '||temp_var||' rows');
    END LOOP;
    END;

  • Number of record  with multi-table insert

    Hi,
    I need to insert into 3 different tables from one big source table so I decided to use multi-table insert. I could use three inserts statements but the source table is an external table and I would prefer not reading it three times.
    I wonder if there is a way to get the exact number of records inserted in each one of the tables?
    I tried using rowcount but I all I get is the number of rows inserted in all three tables. Is there a way to get this info without having to execute a "select count" in each table afterward?
    Thanks
    INSERT /*+ APPEND */
    WHEN RES_ENS='PU' THEN
    INTO TABLE1
    VALUES(CD_ORGNS, NO_ORGNS, DT_DEB, SYSDATE)
    WHEN RES_ENS='PR' THEN
    INTO TABLE2
    VALUES(CD_ORGNS, UNO_ORGNS, DT_DEB, SYSDATE)
    ELSE
    INTO TABLE3
    VALUES(CD_ORGNS, NO_ORGNS, DT_DEB, SYSDATE)
    SELECT ES.CD_ORGNS CD_ORGNS, ES.RES_ENS RES_ENS, ES.DT_DEB DT_DEB, ES.NO_ORGNS NO_ORGNS
    FROM ETABL_ENSGN_SUP ES

    I have a large number of data to load in those three tables. I do not want to use PL/SQL (with loops and lines of codes) because I can do the insert directly from the source table and it saves a lot of time.
    INSERT /*+APPEND*/
    WHEN condition1 THEN
    INTO table1
    WHEN condition2 THEN
    INTO table2
    SELECT xx FROM my_table
    For example, if my_table has 750000000 rows, I only need to read it once and the INSERT..SELECT is a really fast way to load data.
    As I was saying, the only problem I've got, is that I cannot get the number of rows in each table. Do you know a way to get it?

  • Number of records in SETUP table

    Hello
    I am working with PO extractor. Is the number of records in XXXXXXSETUP table equal to the number of records setup?

    Hi if I understand the question the answer is no.  For example I have recently carried out a setup run for Stock Initialisation MC03BX0SETUP.
    The number of records in this table is just over 4000 and when I carry out an opening balance load to BW for the 2LIS_03_BX the number of records are just under 2million
    The setup tables are cluster tables

  • How  to retrieve one row from the number of records in a table

    i want to retrieve the rows from the number of records in a table without using the perticular column name.

    select count(*) from table
    /If you have your table currently analyzed, and no changes have been made, then you could
    select num_rows from user_tables where table_name = 'table'

  • Number of rows in each table

    Hi
    How to find the number of rows in each table of a database by just using a SQL query,
    and should not use the data dictionary tables also... is there any way...??
    Thanks
    MJ

    It can be done in a single SQL like ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>SELECT table_name,
      2         DBMS_XMLGEN.getxmltype ('SELECT Count(*) c FROM ' || table_name).EXTRACT ('//text()').ge
    tnumberval() tot_rows
      3  FROM user_tables;
    TABLE_NAME                       TOT_ROWS
    QUESTIONTYPE                            0
    SRGROUPTABLE                            1
    ST_TEST                                 4
    REGISTER                                0
    DEB_1                                   2
    EMP1                                    0
    6 rows selected.
    Elapsed: 00:00:12.04Credit goes to Michael. ;)
    Regards.
    Satyaki De.

  • Number of entries in each table

    Hi,
    I have a requirement to find the number of entries in each table in the system, how do I find this? If I have to goto each table & find out it is a tedious job. Do we have any standard report kind of thing to find out the number of entries in all the tables at a time....
    Thanks,
    Chandra

    I do not think that there is a Std. SAP report for this. If you check there is a FM CATT_GET_TABLE_ENTRIES that actually gets the table entries. But this is called dynamically.
    Hope this helps.
    Regards,
    Mani

  • Multiple tables with the possibility of multiple records in each table

    Post Author: viper
    CA Forum: .NET
    Hi
    I have been trying for a few days now to come up with a CR solution to displaying data from multiple tables.  These tables, in some cases, have more then one record that needs to be displayed.  This is basically what I am trying to do.....
    I am developing a .net web application(vb) using vs2005 and an oracle 10g backend.  There is a data entry part of the site that users will enter data related to a property.  Other users will be able to search these records and have a list of records returned based on the search criteria.  The user then can click on one of these records to view a pop up CR report containing all the data related to that one property.  The PropID is passed to the pop up page and is used in the WHERE clause of my SQL statement to bring back only one property.  This data can come from as many as 18 tables if all the fields have been entered for this property.  I have tried many different solutions to get the data from multiple tables...and have had some that were close to what I need.  The best one I have will display data from multiple tables but only one record per table.....which doesn't work in my case since some of the tables have more then one record per table.
    Is there anybody that has had success in setting up similar reports?
    Does anybody know how I could use the "Group Expert" to group by the tables in my application?  I can only figure out how to group within a single table.
    It would be great if I could group by table....then just display the record(s) in each table that had the same PropID.  I am not sure if the pdf export would show all the data in that situation but it would be worth a try.  If fact...maybe I could create a new table called MyTables and just add two colums like MyTableID and MyTableName.  Then add all the table names to MyTables that I want to see in the report and add the associated MyTableID value to each table as a new column.  I could then group by MyTableID and PropID.  Just guessing here.
    Any ideas would be appreciated.

    Post Author: quafto
    CA Forum: .NET
    Your query is not too clear so I'll do my best to answer it broadly.
    You mentioned that you have a .NET web application where your users enter data on one screen and then may retrieve it on another. If the data is written in real time to a database then you can create a standard Crystal Report by adding multiple tables. The tables should be linked together using the primary and foreign keys in order to optimize the database query and give you a speedy report. Using unlinked tables is not recommended and requires the report engine to index the tables (it is quite slow).
    You also mentioned you have a "PropID" to be used in a WHERE clause. This is a great place to use a parameter in your report. This parameter can then be used in your record selection formula inside Crystal Reports. The report engine will actually create the WHERE clause for you based on the parameter value. This is helpful because it allows you to simply concentrate on your code rather than keeping track of SQL queries.
    Now, what Crystal does not do well with is uncertainty. When you design a report with X number of tables the report engine expects X number of tables to be available at processing time. You should not surprise the print engine with more or less tables because you could end up with processing errors or incorrect data. You may need to design multiple reports for specific circumstances.
    Regarding the group expert question. I'm not sure how you would/could use the group expert to group a table? A table is a collection of fields and cannot be compared to another table without a complex algorithm. The group expert is used to group and sort records based on a field in the report. Have a look at the group expert section of the help file for more information.
    Hopefully my comments have given you a few ideas.

  • How to restrict the number of Records into the Table?

    Is there any way that I can restrict the number of records can be entered into the table?
    For example I have created a table TAB1 with size category 0( zero).
    User dont want to enter more than 100 values, How to restrict the number entries? Whether Basis can do it?
    Regards,
    Prathap

    Hi Prathap,
    You can write a code in table maintenance events to restrict the number of Records added into the Table to constant.
    Solution:
    Se11 -> enter table name (TAB1) -> F6 -> Utlities -> Table maint. generator -> Envirnment -> modification -> events -> write here the form routine name.
    Double click on routine name. You will get into include section of the code. Write here code like:
    IF current_rec_num > 100.
       messgae error 'Entry restriceted to 100'
    ENDIF.
    Somewhat this way you can achieve your target.
    Regards,
    Sachin

  • Number of Records in one table

    Hi All,
    Can anybody let me know that in Oracle9i lite database, one table can have how many records. I mean is their any restriction on maximum number of ROWs for a table, like Palm database (PDB files) has a restriction that one table can have maximum 64000 rows.
    Is the same thing happen with Oracle lite database also
    Thansk in advance.

    We have had several tests of hundreds of thousands of rows using 9iLite on a PocketPC host. The upper bound appears to be based upon the physical limit of the host and not 9iLite.
    RP.

  • Number of records in internal table

    Hi
    How can I tjeck an internal table for the number of records it contains (even if it contains 0).
    Thanks in advance, regards
    Torben

    Hi,
    DESCRIBE TABLE itab.
    Effect
    Returns the attributes of the internal table itab. You must use at least one of the additions listed below:
    Note
    The DESCRIBE statement cannot be used for all ABAP types. In connection with ABAP Objects, SAP has introduced a RTTI concept based on system classes to determine type attributes at runtime. This concept applies to all ABAP types and as such covers all the functions of the DESCRIBE TABLE statement.
    Extras:
    1. ... LINES n
    2. ... OCCURS n
    3. ... KIND   k
    Addition 1
    ... LINES n
    Effect
    Places the number of filled lines of the table t in the field lin. The value returned to lin has type I.
    Note
    The number of filled lines of the table itab can also be ascertained using the predefined function lines( itab ).
    Example
    DATA: N    TYPE I,
          ITAB TYPE TABLE OF I.
    CLEAR ITAB.
    APPEND 36 TO ITAB.
    DESCRIBE TABLE ITAB LINES N.
    Result: N contains the value 1.
    Addition 2
    ... OCCURS n
    Effect
    Passes the size of the OCCURS parameter from the table definition (as defined with DATA) to the variable n. The value returned to n has type I.
    Example
    DATA: N1    TYPE I,
          N2    TYPE I,
          ITAB1 TYPE TABLE OF I INITIAL SIZE 10,
          ITAB2 TYPE I OCCURS 5.
    DESCRIBE TABLE ITAB1 OCCURS N1.
    DESCRIBE TABLE ITAB2 OCCURS N2.
    Result: OCC contains the value 10 and N2 the value 5.
    Addition 3
    ... KIND k
    Effect
    Writes the table type from itab to the variables n. The value returned to k is of type C. The constants SYDES_KIND-STANDARD, SYDES_KIND-SORTED and SYDES_KIND-HASHED are defined in the type group SYDES for the return values.
    Example
    Generic FORM routine any table type
    TYPE-POOLS: SYDES.
    FORM GENERIC_FORM USING ITAB TYPE ANY TABLE.
      DATA: K TYPE C.
      DESCRIBE TABLE ITAB KIND K.
      CASE K.
        WHEN SYDES_KIND-STANDARD.
        WHEN SYDES_KIND-SORTED.
        WHEN SYDES_KIND-HASHED.
      ENDCASE.
    ENDFORM.
    Notes
    Performance: The runtime for executing the DESCRIBE TABLE statement is approximately 4 msn (standardized microseconds).
    The DESCRIBE TABLE statement also passes values to the SY-TFILL and SY-TLENG System fields
    Additional help
    Determining the Attributesof Internal Tables
    Thanks,
    Sankar M

  • Number of records in setup tables

    Hi all,
    How do we find out the number of records extracted into setup tables ?
    Thanks in advance
    Kiran

    Hi Kiran,
    You can check in the RSA3 for the data source.
    In TA NPRT check for the no.of records and then cross check in SE16.
    Assign points if it helps
    Regards,
    Sinivas
    Message was edited by:
            Srinivas
    Message was edited by:
            Srinivas

  • Number of records in FAGLFLEXT table

    Dear colleagues,
    Could You please tell me what the maximum number of records FAGLFLEXT table may contain.
    I was said during FI-GL migration project in 2008 that the optimal number of records is 500 000 per year.
    After having implemented new project we expect the number of records to increase approximately up to 1 500 000 - 3 500 000 records for 1 year. Is this critical?
    I read at the forum that SAP recommends to have maximum 10 000 000 records in this table but it was not clarified for what period: for one year or for the whole life of the system.
    Regards,
    Stanislav.

    - hope below notes help.
    [Note 820495|https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=820495]
    [Note 1045430|https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1045430]
    Rgds.

  • RFC function to return number of records in a table

    Hello,
    I am looking for a RFC function to return just the number of records in a SAP table.
    I don't want to use RFC_READ_TABLE since it takes too long when I query a big table.
    Any advices?

    Check the following post: Link: [Re: RFC function module to count records in DB table;

Maybe you are looking for

  • BO XI 3.1 Infoview document refresh problem

    Hi, We have a cluster for BO XI 3.1 in this way: - Servers A & B in cluster. - Server C hosting CMS database. The 3 servers are on Windows Server 2003. Database is under SQL Server 2008 on server C. We encounter sometimes refresh/display problems on

  • Can airport express be used for all audio from my ibook?

    I want to be able to route all of my computer audio to the airport express station conected to my stereo. This would come in handy when I want to watch DVD's on my laptop in my dorm room. Airport Express   Mac OS X (10.4.4)  

  • Purchase order print priview and spool print output are different.

    Hi Friends, there is problem with purchase order print priview and spool print output are different. mean : in me23n .. for a perticular po .. in po priview the TAX VALUES value is 120 coming.. when i am giving print with spool.. the amount value is

  • RD web access 3 passwords to connect

    I am setting up a new remote desktop access gateway to allow users to connect to their local desktops. I have it working but it requires 3 logins to connect. 1 for the web access, 2. for the RD gateway and then to the PC. Is there a way to streamline

  • LSMW Vendor Load - Including Email Address

    Hello Experts, I am using LSMW to load vendors from a legacy system into SAP using the following: *Batch Input Method *Object 0040 *Method 0001 *Program RFBIKR00 Now, I understand that RFBIKR00 does not support the ARD6 table for email addresses, whi