Gettıng record number of all tables

how can get the record number(count(*) ) of all the tables of the specıfıc user.

u can query user_tables and see the num_rows column
of that table of a corresponding schema."U" can but you would you would not being doing it the best way if you do.
SQL> select table_name, num_rows from user_tables;
TABLE_NAME                       NUM_ROWS
EMP                                    15
TEST                                    2
SQL> select count(*) from test;
  COUNT(*)
         6
SQL>It only works if the stats have been gathered on the tables and you don't really want to be gathering stats every time you want to know how many rows there are on your tables.
The best and most accurate way to count the number of rows on tables is to use count(*).

Similar Messages

  • Get the records number from internal table with conditon.

    Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
    actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?

    Hi,
    One alternative solution, which may be useful for other parts of your program, is to have an aditional itab1 with a single column/field (field1), which acts like a index or shadow table, and which is filled simultaneously with itab. Then you can use DESCRIBE TABLE itab1 LINES lv_lines.
    Atb

  • Get records count of all tables

    Hi ,
    I am trying to get the record count of all tables using dynamic query. I don't know how to put the value in placeholder. I tried the below code.
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
         CURSOR table_list
         IS
         select OBJECT_NAME from user_objects
         where object_type in ('TABLE')
         and object_name not like '%AUDIT_DDL%'
         AND object_name not like 'MD_%'
         AND object_name not like 'EXT_%'
         AND object_name not like 'STG_%'
         AND object_name not like 'SYS_%'
         AND object_name not like 'TMP_%'
         AND object_name not like 'TEMP_%'
         order by 1;
         v_count     NUMBER :=0;
         query_str VARCHAR2(1000);
    BEGIN
         FOR table_name IN table_list
         LOOP
              query_str :='SELECT COUNT(1) FROM  ' || table_name.OBJECT_NAME;
    dbms_output.put_line(query_str);
              dbms_output.put_line('Table Name:' || table_name.OBJECT_NAME );
              v_count:= execute immediate query_str;
              dbms_output.put_line('Table Name:' || table_name.OBJECT_NAME || ', Count ' || v_count );
         END LOOP;
    END;
    I know I am doing wrong in the bold lines. But not sure how to fix it. Please help. Thanks in advance.

    Hi,
    Welcome to the forum!
    What you posted is basically right, assuming you really want to do dynamic SQL t all.
    The only problem with
    961618 wrote:
              query_str :='SELECT COUNT(1) FROM  ' || table_name.OBJECT_NAME; would be if the object name included special characters (such as single-quotes) or lower-case letters. To avoid any possible problems, I would put the object name inside double-quotes:
    ...     query_str := 'SELECT COUNT (*) FROM "' || table_name.OBJECT_NAME
                                               || '"';
              v_count:= execute immediate query_str;
    The correct syntax is
    execute immediate query_str INTO v_count;V_count will be the number of rows in a single table. Keep another variable (say total_v_count) that keeps the total count so far.
    Do you really need dynamic SQL?
    SELECT     SUM (num_rows)     AS total_rows
    FROM     user_tables
    WHERE     table_name     NOT_LIKE '%AUDIT_DDL%
    AND     ...
    ;gets the same information, accurate as of the last time statistics were gathered, and some of the numbers may be approximate. Depending on how you use the results, that may be good enough for you. If you actually have 10,000,123 rows, and the query says you have 10,000,000, does it really matter?

  • Help needed to get unique record from an internal table

    Hi Everybody,
    I have to get unique record from an internal table. i know we can use read statement with key condition .
    But the problem is i have to use some relational operators like GE or LE.
    eg
    read table itab into wa with key width GE itab-widthfrom
                                                       width LE itab-widthto
                                                       machno eq itab-machno.
    Its giving me error when I use the operators GE , LE.( I think since it can't find a unique record with those relational
    operators in the with key statement)
    Is there any other way to get unique record from internal table without using the loop?
    Thanks,
    Sunny

    Using the read statement you will need some kind of loop. For example.
    DO.
    READ TABLE......
      WITH KEY ......
                        READ = SPACE
    IF SY-SUBRC EQ 0
      TABLE-READ = 'X'.
      MODIFY TABLE
      ADD 1 TO W_FOUND.
    ELSE
      EXIT.
    ENDIF
    ENDDO.
    IF W_FOUND EQ 1.
    ...record is unique.
    ENDIF.

  • Get FI Documet number from BKPF table using CO document number in COVP tabl

    Hi,
    In  datasource 0CO_OM_CCA_9 , we have written a code in CMOD to get the FI Document Number from CO document Number.
    The flow of code is:
    1) From the CO document number, get reference document number  (REFBNfield) from, COVP table
    2) Pass this REFBN in AWKEY(10) field of BKPF table.
    3) We have created new field in datasource named 'ZBELRE' which gets populated with BELNR field obtained from BKPF table.
    This ZBELNR is the FI Document number.
    But somehow wrong FI Document number is getting populated.
    After analyzing code, we found that the AWKEY which we passed in BKPF table is incomplete and the full AWKEY is
    COVP-REFBN+COVP-AWORG
    Is this condition always remains true in all the cases? Also, is the selection criterion which we have used to find the FI document number from BKPF table is sufficient?
    Our CO Consultant says that we should also pass AWTYP along with AWKEY in BKPF table.
    Please suggest a solution.
    Following is the code :
    ***********Datasource Modification for0CO_OM_CCA_9*******************
      WHEN '0CO_OM_CCA_9'." Data Source
        TYPES:BEGIN OF ty_bkpf,
        belnr TYPE bkpf-belnr,
        xblnr TYPE bkpf-xblnr,
        bktxt TYPE bkpf-bktxt,
        awkey TYPE bkpf-awkey,
        bukrs TYPE bkpf-bukrs,
        gjahr TYPE bkpf-gjahr,
        END OF ty_bkpf.
        TYPES : BEGIN OF ty_bseg1,
        lifnr TYPE bseg-lifnr,
        belnr TYPE bseg-belnr,
        bukrs TYPE bseg-bukrs,
        gjahr TYPE bseg-gjahr,
        END OF ty_bseg1.
        DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
        wa_bkpf TYPE ty_bkpf,
        it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
        wa_bseg1 TYPE ty_bseg1,
        l_s_icctrcsta1 TYPE icctrcsta1.
        "Extract structure for Datasoure 0co_om_cca_9.
        DATA: l_awkey TYPE bkpf-awkey.
        DATA: l_gjahr1 TYPE gjahr.
        DATA: len TYPE i,
        l_cnt TYPE i.
        l_cnt = 10.
        SELECT lifnr
        belnr
        bukrs
        gjahr
        FROM bseg
        INTO TABLE it_bseg1.
        DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
        SELECT belnr
        xblnr
        bktxt
        awkey
        bukrs
        gjahr
        FROM bkpf
        INTO TABLE it_bkpf.
        IF sy-subrc EQ 0.
          CLEAR: l_s_icctrcsta1,
          wa_bkpf,
          l_awkey,
          wa_bseg1.
          LOOP AT c_t_data INTO l_s_icctrcsta1.
            MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
            READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
            l_s_icctrcsta1-refbn
            gjahr = l_gjahr1.
            IF sy-subrc EQ 0.
              MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
              MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
              MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
              MODIFY c_t_data FROM l_s_icctrcsta1.
              READ TABLE it_bseg1 INTO wa_bseg1
              WITH KEY
              belnr = wa_bkpf-belnr
              bukrs = wa_bkpf-bukrs
              gjahr = wa_bkpf-gjahr.
              IF sy-subrc EQ 0.
                MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
                MODIFY c_t_data FROM l_s_icctrcsta1.
                CLEAR: l_s_icctrcsta1,
                wa_bseg1,
                l_gjahr1.
              ENDIF.
            ENDIF.
            CLEAR: l_s_icctrcsta1.
          ENDLOOP.
        ENDIF.
    ***End of Datasource Modification for 0CO_OM_CCA_9*******************

    Hi,
    this forum is for the SAP BusinessObjects BI Solution Architecture. Please post your question into the corresponding product forum for SPA BW
    regards
    Ingo Hilgefort

  • Get records number from internal table with condition.

    Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
    actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?

    hello,
    Every time assigning data into temp table and delete may that may not be much efficient. You can check in loop logic how much time is taken. You can check the below code. here I am trying to check the numbers of plant for for one material.
    In this logic material is the first field. So if there is option to make the required field in to the 1 st position then it will be nice.
    TYPES: BEGIN OF x_count,
            matnr TYPE matnr,
            count TYPE i,
           BEGIN OF x_count.
    DATA: i_marc  TYPE STANDARD TABLE OF marc,
          i_count TYPE STANDARD TABLE OF x_count,
          wa_count TYPE x_count.
    FIELD-SYMBOLS: <wa_marc> TYPE marc.
    SELECT * UP TO 1000 ROWS
      FROM marc
      INTO TABLE i_marc.
    IF sy-subrc = 0.
      SORT i_marc BY matnr.
      LOOP AT i_marc ASSIGNING <wa_marc>.
        wa_count-count = wa_count-count + 1.
        AT END OF matnr.
          wa_count-matnr = <wa_marc>-matnr.
          APPEND wa_count TO i_count.
        ENDAT.
      ENDLOOP.
    ENDIF.
    Thanks
    Subhanakr

  • Query to display all records count of all tables in a schema

    Hi,
    I need to count all the records of all my tables in a certain schema and display the max amount of the record count. Do you have a script for this one??

    SQL> create function countrec(in_tab in varchar2) return number is
      2  retval number;
      3  begin
      4    execute immediate 'select count(*) from '||in_tab into retval;
      5    return retval;
      6  end;
      7  /
    Function created.
    SQL> select table_name, countrec(table_name)
      2  from tabs;
    TABLE_NAME                     COUNTREC(TABLE_NAME)
    QUERY_TOOL_DATA_COLLECTION                        5
    TEST01                                            0
    T1                                               14
    EMP                                              14
    SALGRADE                                          5
    FILES                                             0
    PROVA                                             0
    TEST                                              0
    T_MASTER                                          1
    T_CHILD                                           3
    TAB_ONE                                          30
    TAB_TWO                                          10
    A                                                 3
    B                                                 4
    C                                                 3
    D                                                 3
    BONUS                                             0
    DEPT                                              4
    18 rows selected.Max

  • How to get the disco model with all tables and fields ?

    Hello !
    I have to make a document showing all the tables and fields I have in my EUL ... This would be a good documentation for our company and our clients too !
    I haven't find any ways to perform this directly from disco admin and I can't make a query using the EUL tables ...
    Please Help ...

    Hi,
    I am assuming you are using Discoverer 4.1/4i. In the Oracle Home\Discvr4 directory contains an EUL4.eex file. Import this in Admin edition, and it will create a business area on your EUL. Then you can get details on the Folders and Items and use it to create reports....
    Cheers
    Deepak

  • New italk can't get a record option at all

    I just got a 20G 4th gen ipod (click wheel) and then bought the griffin Italk to record lectures with. I plugged in my italk and nothing appears to give me the opportunity to record. I have done 1. reset with italk plugged in 2. removed italk for 1 min. and tried again blah blah blah. When I plug in the italk the red led light blinks three times and nothing else happens.
    Anyone know why it might be having trouble?
    Gretchen

    I've got the same setup as you - You should get an option to record as soon as you plug the iTalk in - the red light should blink a few times and then go out - does anything at all appear on the screen ? The only thing I can suggest is that its not plugging in properly - some protective covers prevent accesories from plugging in correctly - if you have one on the iPod try taking it off - If not you might have a faulty iTalk

  • Get Record Number of a Datasource

    How can I get the record number of a view object
    <jbo:DataSourceRef id="dsBrowse" reference='<%=request.getParameter("datasource")%>' />
    <jbo:RowsetIterate datasource="dsBrowse" changecurrentrow="true">
    <jbo:RenderValue datasource="dsBrowse" dataitem="Item" />
    </jbo:RowsetIterate>
    I want to display the records when the recordcount is >0. In other case I want to display a message about "No Records Found"
    So I Wnat somehow the record number of datasource.

    Kostas -
    Use the getRowCount() method as such:
    <% int rowcount = dsBrowse.getRowSet().getRowCount();
    if rowcount > 0 { %>
    <jbo:RowsetIterate datasource="dsBrowse" changecurrentrow="true">
    <jbo:RenderValue datasource="dsBrowse" dataitem="Item" />
    </jbo:RowsetIterate>
    <% }else{ %>
    No records found
    <% } %>
    Hope this helps,
    Lynn
    Java Tools Team
    How can I get the record number of a view object
    <jbo:DataSourceRef id="dsBrowse" reference='<%=request.getParameter("datasource")%>' />
    <jbo:RowsetIterate datasource="dsBrowse" changecurrentrow="true">
    <jbo:RenderValue datasource="dsBrowse" dataitem="Item" />
    </jbo:RowsetIterate>
    I want to display the records when the recordcount is >0. In other case I want to display a message about "No Records Found"
    So I Wnat somehow the record number of datasource.

  • Row number in the table.

    Hi:
    How can get the row number in its table?
    For example:
    I have table a:
    a1-a2
    5---a
    2---b
    7---c
    3---d
    I want for a1 value 7, I want to get 3 (the row number in the table).
    Regards
    Saad

    > You know there is ROWID, is there a way to know row number in the table by ROWID?
    No. ROWID is the physical address of the row. It specifies the location of the row on disk. Nothing more. There is no numbering involved.
    > Should there is a way, because there is some programs deal with the table row as it in
    the table.
    These programs are wrong.
    > Ok, I have a software (SmartCodeStudio) which deal with the database to print rows from
    a table but he deals with "record" which is row number in the table
    Wrong, wrong, wrong. A RDBMS is not a binary flat file. A row in a relational table is identified by its primary key. Period.
    There seems to be nothing smart about SmartCodeStudio if it is not capable of dealing with a relational design, and primary key identifiers.

  • Record count of all DSOs

    Hi Experts,
    Does any one have an idea as to
    how to get the record count of all DSOs in one shot?
    Regards
    Dipali

    Tran ST14 allows you to run a background program that captures  data on the 30 largest ODS.  Might be able to run it, or use the program it runs as a starting point for a Z version.  It also produces other lists 30 largest cubes, E anf F fact tables, dimension tables, PSA, master data, etc.
    This alignment of the sample below isn't quite right, but it gives you an idea of the output:
          Logical Name (BW) Active Data      Active Data     Activation Queue Activation Queue Rollback      Rollback      Changelog      Changelog      Changelog      Total Size      Growth      RSDBEXFL      LASTUSED      TXTLG                                              ODSOTYPE       
                         Size (KB)         records             Size           records          Size         records      Name              Size (KB)      records      (KB)               (KB)                           
          ZPU_O52        223084800       270319290              128            72020             0             0      /BIC/B0000357000   1898496        3020700       224983424           0           X      20080903190013      Line Items in Funds Management            
          ZSL_O52        164580224        285739820              128           215490             0             0      /BIC/B0000558000   3041280        5548000       167621632           0           X      20080903135047      Special Ledger Details            
          ZGL_O_02         94384640        253558550              128           394820           128             0      /BIC/B0000595000   2469888        5227867        96854784           0           X      20080903180839      General Ledger: Line Item Detail            
          PU_O32                 72226624        114269900              128            13880           128             0      /BIC/B0000325000   1768448        3172567        73995328           0                             0      FI Line Items in Funds Management (IS-PS)            
          ZARS_O70         65613632        131033900              128                0           128             0      /BIC/B0000537000   2744320        5117567        68358208           0           X      20080828130735      Activity-based Reporting            
          PU_O33                 49556224        107794700              128            44533             0             0      /BIC/B0000327000   1468416        2495200        51024768           0                             0      CO Line Items in Funds Management (IS-PS)            
          ZCBP_CON          7841792         11669800              128            13550           128             0      /BIC/B0000958000   9650176       15398900        17492224           0           X      20071114174148      COPY OF ZBBP_CON            
          ZAP_O_02         15391808         27049480              128            42380             0             0      /BIC/B0000594000    569344         817460        15961280           0           X      20080903190031      Accounts Payable - Vendors: Line Item Detail            
          ZCBBP_PO          6334464          9345900              128            11493           128             0      /BIC/B0000957000   9124864       14334000        15459584           0           X      20080818174802      Copy of 0BBP_PO            
          PU_O31                 12421696         21020500              128            13123             0             0      /BIC/B0000310000    607232        1183300        13029056           0                             0      Commitments Line Items in Funds Management (IS-PS)            
          ZAP_OTW1         10814208         28065630              128          1091100           128             0      /BIC/B0000608000    957440        2711567        11771904           0           X      20080903110025      Accounts Payable:  Treasury Warrant Info            
          ZSEM_O51          6937344         17585900              128                0           128             0      /BIC/B0000584000   4678784       12101200        11616384           0           X                   0      Complement Data for Costing            
          BBP_PO                   991232                0              128                0           128             0      /BIC/B0000167000       128              0        10116480           0                             0      Purchase Order - Single Documents            
          ZCBP_INV          3613696          5889633              128             7167           128             0      /BIC/B0000959000   4551680        6404367         8165632           0           X      20071114161251      COPY OF 0BBP_INV            
          ZPU_O51          7032896         14555300              128             2093           128             0      /BIC/B0000352000    160768         392960         7193920           0           X      20080903141737      Budget in Funds Management            
          ZSEM_O52          3749952         17608900              128                0           128             0      /BIC/B0000585000   2978944       10656100         6729152           0           X                   0      Complement Cost Data from HRV1018            
          ZSLGS_O1          2781184          5666200              128            18360           128             0      /BIC/B0000841000   3241984        6964467         6023424           0           X      20080903145240      FISL: SRM Global Spend Detail            
          BBP_DS1          5011456          5870533              128            18070           128             0      /BIC/B0000198000    548864         846330         5560576           0                             0      Actual Value for Purchase Order -Single Documents            
          ZIC_O03          4332096          9217400              128            10477           128             0      /BIC/B0000587000     45056          91627         4377408           0                             0      ODS Material Stocks / Movements            
          BBP_SC                  1542400          1493100              128            19663           128             0      /BIC/B0000733000    119808         382750         2363904           0                             0      Shopping Cart - Individual Documents            
          ZRR_O01           290816           781850              128             1263             0             0      /BIC/B0001007000   1815552        4045433         2106496           0           X      20080211170935      Revenue & Refunds DSO            
          BBP_DOC           797184          1359533              128             6978           128             0      /BIC/B0000732000    481280          51307         1278720           0                             0      Document Flow - Single Documents            
          BBP_CON          1227776                0              128                0           128             0      /BIC/B0000194000       128              0         1228160           0                             0      Goods/Services Confirmation - Single Documents            
          ZAR_O_02           840960          1288300              128            1427           128             0      /BIC/B0000593000    132096         199870          973312           0           X      20080711125812      Accounts Receivable - Customers:Line Item Detail            
          SRPO_D1           311296           375290              128             6176             0             0      /BIC/B0001036000    384000         500900          695424           0                             0      Purchase Order History            
          ZSLFM_O1           542720          2404400                0                0             0             0      /BIC/B0000666000       128              0          542848           0                             0      Expenditure Estimation - FM                             T       
          BBP_INV           461824                0              128                0           128             0      /BIC/B0000196000       128              0          462208           0                             0      Invoice - Single Documents            
          ZSL_O3                   458752          2430400                0                0             0             0      /BIC/B0000670000       128              0          458880           0                             0      Expenditure Estimation - SL Data                     T       
          ZPM_O51           196928           755080              128                0           128             0      /BIC/B0000894000    159744         703770          356928           0           X      20080507175910      Plant Material Valuation History            
          ZGL_O3                   235520          2422767                0                0             0             0      /BIC/B0001041000       128              0          235648           0                             0      Expend Est - GL Svc Dt                                     T     
    There are DB dictionary views that contain this info as well,  some of which is copied ot SAP tables.  If you have Oracle DB, look for a table DBSTATTORA.

  • Record-number from SQL Loader

    Hello All,
    Is there a way I can add line-number/record-number into my tables. For example if my input file has 10 records, I want 10 rows with record_number=1-10?
    Need your help!
    Thanks

    Maybe (s)he wasn't referring to "sequence" the database object ... rather, the "sequence" parameter for SQL*Loader.
    Anyway, I think you need RECNUM ... search the doco for "RECNUM" ... close by you'll find explanation on what "SEQUENCE", the SQL*Loader parameter, does too.

  • Is there a way go get the item number of the current item?

    In an item with multiple instances: Is there a way to get the item number of the current item? If for instance, I am on the 3rd item, is there some kind of “GET CURRENT RECORD NUMBER” built-in that would return a ‘3' to the program?
    Thanks
    Edited by: WayneFMcKinstry on Apr 9, 2010 10:50 AM

    If i am getting you correctly that in tabular item you want to know the current record or current item you can try this...
    For current record
    :SYSTEM.CURSOR_RECORD;
    or
    :SYSTEM.CURRENT_RECORD;for current item
    :SYSTEM.CURSOR_ITEM;-Ammad

  • Current row number in internal table

    HI,
    How to find current number of record in internal table which is being processed.
    Srini.

    Hi Srinu,
    Welcome to SDN...
    The system field <b>SY-TABIX</b> will give the current number of record in an internal table.
    If the internal table is iterated through LOOP...ENDLOOP then for each iteration the SY-TABIX will be incremented by one.
    If the internal table is iterated through LOOP...ENDLOOP  WHERE <COND> then for each iteration the SY-TABIX will hold the condition met record number.
    READ TABLE ITAB WITH KEY F1=<VAL> . The SY-TABIX will hold the record number of success record.
    Thanks,
    Vinay

Maybe you are looking for

  • How can SMART METER Technology be integrated with SAP ISU system?

    At present the SMART METER technology is integrated with SAP ISU through a third party vendor. The idocs are sent to a third party and the readings are downloaded and sent back in idoc segments. How can the integration be done without the third party

  • Put up with Infinity for over a year. About to rag...

    Title says it all. I had no real problems with BT broadband until I upgraded to Infinity. Then the fun began. Currently scraping along at 4Mb download speed. Cannot physically bring myself to phone BT AGAIN, and go through the same ludicrious set of

  • Open GL now causing HARD CRASHES after upgrade to 10.5.7

    I have a 2.5 year old mac pro intel mac quad core. My graphics card is NVIDIA GeForce 7300 GT. After the last update, I get hard crashes when I used OpenGL intensive programs such as Photoshop and Electric Image Animator. Electric Image is a 3d progr

  • JTable with column spanning

    Hi Can anyone plz help me in creating a JTable which can span different columns in different rows. Like i want the first row to be with 5 columns, second row to be with 3 columns and 3rd row to be with 4 columns. Can anyone plz help me in this. Thank

  • Paging Navigation problem (Solve priority basis...)

    Dear apex community members; Hopfully all of you will be fine. Please tell me that; I have developed an application in apex. where I have used Application Express Authentication Scheme. With Access Control Page. I have create some users, and authoriz