Comparing tables

how to compare two tables between 2 systems/servers?

Hi Balu,
            Create a FM for that and make that as remoty enabled.so that u could call the FM as RFC in other server/system.
In source code of FM write query for fetching data of the table.
make Import & table parameters as PASS BY VALUE.
Now call this FM in other system Using destination to first server.
create destination in SM59 and pass the IP address of first server there.
syntax:
call function 'FM Name'
destination 'ser1'
exporting
importing
exceptions
Reward points if helpful.
Regards,
Hemant

Similar Messages

  • How to compare table's date field with dropdown year field

    Hi All,
    I have one requirement to display the selected rows from a database table based on the selection of drop down.
    Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE".
    Now, I want to compare table's DATE field with my dropdown field.
    Problem is that table's DATE field is of type "DATS" and dropdown is of type INTEGER(or) STRING ...
    How to compare this fields?
    Can any one please give me solution for this...!
    Thanks in Advance!

    Hi  sreelakshmi.B,
    try the following:
    DATA lt_dats        TYPE TABLE OF dats.
    DATA l_dat_i        TYPE          i.
    DATA l_dat_c_4(4)   TYPE          c.
    DATA l_dat_c_12(12) TYPE          c.
    DATA l_dats_from    TYPE          dats.
    DATA l_dats_to      TYPE          dats.
    *Move Date from Integer to Char
    l_dat_c_4 = l_dat_i = 2005.
    *Create Date From use in WHERE-Clause
    CONCATENATE '01.01.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_from
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    *Create Date To use in WHERE-Clause
    CONCATENATE '31.12.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_to
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    * Select records in range
    SELECT *
           FROM [DBTAB]
           INTO TABLE [ITAB]
           WHERE [DATE] BETWEEN l_dats_from
                        AND     l_dats_to.
    Regards
    REA

  • Compare table data between two schemas?

    Hi,
    I am looking for a script to compare the table data between the schemas (two different databases)? I know how to compare table by table but looking for a generic script where I can compare all the tables data from one schema to another schema?
    Thanks a lot...

    here the idea, adapt it with your needs :)
    Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
    Connected as SYS
    SQL> create user user1 identified by user1;
    User created
    SQL> grant create  session to user1;
    Grant succeeded
    SQL> grant create table to user1;
    Grant succeeded
    SQL> alter user user1 quota 10m on DATA;
    User altered
    SQL> create user user2 identified by user2;
    User created
    SQL> alter user user2 quota 10m on DATA;
    User altered
    SQL> grant create table to user2;
    Grant succeeded
    SQL> grant create  session to user2;
    Grant succeeded
    SQL> create table user1.test(a Number) tablespace DATA;
    Table created
    SQL> create table user2.test(a Number) tablespace DATA;
    Table created
    SQL> insert into user1.test values (1);
    1 row inserted
    SQL> insert into user1.test values (2);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> insert into user2.test values (2);
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> create table sys.logs(Diff number) tablespace data;
    Table created
    SQL> select * from sys.logs;
          DIFF
    SQL>
    CREATE OR REPLACE PROCEDURE TEST_MY_DIFF IS
      CURSOR CUR_ IS
        SELECT D.TABLE_NAME T_NAME FROM DBA_TABLES D WHERE D.OWNER = 'USER1';
      W_DIFF NUMBER;
      TYPE CV_TYP IS REF CURSOR;
      CV CV_TYP;
    BEGIN
      EXECUTE IMMEDIATE 'TRUNCATE TABLE SYS.LOGS';
      FOR I IN CUR_ LOOP
        W_DIFF := 0;
        OPEN CV FOR 'select count(*)
    from
    ( select * from USER1.' || I.T_NAME || '
    minus
    select * from USER2.' || I.T_NAME || ' )
    union all
    ( select * from USER2.' || I.T_NAME || '
    minus
    select * from USER1.' || I.T_NAME || ')
        LOOP
          FETCH CV
            INTO W_DIFF;
          INSERT INTO SYS.LOGS VALUES (W_DIFF);
          COMMIT;
          EXIT WHEN CV%NOTFOUND;
        END LOOP;
      END LOOP;
    EXCEPTION
      WHEN OTHERS THEN
        NULL;
    END;
    SQL> BEGIN
      2  test_my_diff;
      3  end;
      4  /
    PL/SQL procedure successfully completed
    SQL> select * from sys.logs;
          DIFF
             1
             1

  • To compare Table in different Database

    Hi
    Is possible to compare tables in Different Database ?
    They are same tables , but data can to be different
    TIA

    May be you can try with DBMS_RECTIFIER_DIFF.DIFFERENCES

  • Compare table A and table B and update table B ,,,,table B has 300k rows

    Hi,
    I m trying to write a code, I have tables A and table B.
    I need to compare table A and table B , and update table B with one column.
    using joins b/w A&B tables, I selected one record from table A in cursor.
    After Begin I m trying to open cursor and in FOR LOOP
    Im trying to update table B WHERE CURRENT OF Cursor.
    this is erroring out.
    could you let me know on this.
    there is another way like selecting required columns from both table.but i was told to do as above.
    Thanks

    > this is erroring out.
    You haven't posted nearly enough for anyone to help you.  You didn't even tell us what error you are getting.
    So about the only thing we can do is post a generic MERGE statement which you'll have to modify for your use.
    merge into tableB b
    using (select some_key, some_column from tableA where etc.) u
    on (u.some_key = b.some_key)
    when matched then update
    set b.some_column = u.some_column;

  • How to compare table data and table field

    Hi buddy,
        I have some question about how to compare table data and table field.
       1. I know there is one method:   CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS  , it use in unit test to compare the table data(A and B) , you can loop table A into structure A1, then use this mehtod it can compare whether table B contain structure A1.  but when I try to use this in main program it will dump.
              CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS(
                                                                                                        LINE    = A1
                                                                                                        TABLE = B ).
           Is there any method or FM can be used to compare the table data ?
        2. I also want to compare two table field , try to find out the different. How to realize this.
    Thank you for your sincerely answer.

    Hi Zongjie,
    What`s the difference, if you using loop A into wa_A, read table B into wa_B with all field, then compare with wa_A and wa_B.
    The question 2, seems no standard FM available here.
    Loop A into wa_A.
       Loop B into wa_B.
           if wa_A-field1 eq wa_B-field1.
           endif.
            if wa_A-field2 eq wa_B-field2. 
           endif.
       endloop.
    endloop.
    regards,
    Archer

  • Comparing Table between two dbs DBMS_RECTIFIER_DIFF.DIFFERENCES

    We have streams replication between two databases db1 & db2 (table level streams replication).
    We would like to compare tables between these databases.
    we can use DBMS_RECTIFIER_DIFF.DIFFERENCES to find out differences. However what is value to be passed for REFERENCE_SITE & COMPARISON_SITE parameters?
    Is it DBLINK or TNSNAMES entry ?

    Its the DBLINK.

  • Tcode for comparing tables

    Hi all,
    Can anyone tell me the t code for comparing tables
    Regards,
    Sowmya

    Hi,
    If it for data then,
    SCMP      Check the table data across clients..
    cheers,
    jacks

  • Compare Table fields

    I want to compare tables and fields(not values)... which Tcode I can use?

    Hi,
    Compare Tables.  --> SCU0
    Compare Tables.  --> OY19
    Regards
    Sudheer

  • FM9 Compare Documents - compare tables

    We have to create a “redline” document for distribution that compares a new version of a document to a previous version of the document, for each draft revision we generate.
    The FM9 Compare Documents utility works great for identifying insertions and deletions in basic text. However, our documents are full of tables. Many, many very long tables.
    If anything about a table structure changes between the previous and new version (i.e., a row is added/deleted, a column is added/deleted, the anchor is moved, or any cell formatting is changed) then FM simply inserts both the old table and new table in the composite document. The only conditional tracking it does with the tables is to put a change bar next to the old and new table anchors, and only the anchors take on the conditional color (i.e., red for deleted or blue for inserted), not the tables themselves.
    In the composite document, the two tables look like regular text - no conditions are applied. We have to MANUALLY color-code the insertions and deletions within all of the tables. This can literally take days. There has GOT to be a better way to make this more efficient!
    So my question is: is there any way to automatically identify the changes within tables in FrameMaker, or with any application that would partner with FrameMaker? I can’t find enough information about FrameMaker 10 to know if they have addressed the Compare Documents feature between tables.
    Any help on this topic would be greatly appreciated!
    Cathy Outlaw
    Technical Communicator

    cathy_outlaw wrote:
    We have to create a “redline” document for distribution that compares a new version of a document to a previous version of the document, for each draft revision we generate.
    The FM9 Compare Documents utility works great for identifying insertions and deletions in basic text. However, our documents are full of tables. Many, many very long tables.
    If anything about a table structure changes between the previous and new version (i.e., a row is added/deleted, a column is added/deleted, the anchor is moved, or any cell formatting is changed) then FM simply inserts both the old table and new table in the composite document. The only conditional tracking it does with the tables is to put a change bar next to the old and new table anchors, and only the anchors take on the conditional color (i.e., red for deleted or blue for inserted), not the tables themselves.
    In the composite document, the two tables look like regular text - no conditions are applied. We have to MANUALLY color-code the insertions and deletions within all of the tables. This can literally take days. There has GOT to be a better way to make this more efficient!
    So my question is: is there any way to automatically identify the changes within tables in FrameMaker, or with any application that would partner with FrameMaker? I can’t find enough information about FrameMaker 10 to know if they have addressed the Compare Documents feature between tables.
    Any help on this topic would be greatly appreciated!
    Cathy Outlaw
    Technical Communicator
    Have you tried Table > Convert Table to Text in both documents and comparing the text?
    **EDIT
    Converting "regular" tables - i.e., no straddled (merged) cells - is pretty reliable, but tables with straddled cells are unpredictable.
    Also I haven't tried comparing tables via their text conversions myself. If this works, you can convert text back to table, though I'm not sure how your marked-up changes might be preserved in the table.
    EDIT**
    HTH
    Regards,
    Peter Gold
    KnowHow ProServices
    Message was edited by: peter at knowhowpro

  • Compare Table Data on 2 different databases having same schema

    I need to compare data in all the tables in 2 different databases having same schema.
    If there is any difference in data in any table on Database1 and Database2 then I need to update/insert/delete the rows in my table in Database2.
    So Database1 is my source database and Database2 is my sync database. I cannot use expdp tables as I am not having sufficient privileges to the database server.
    Also I cannot drop and recreate the tables as they are huge.
    Can anyone please guide me how to compare data and to write a script to comapre the changes in say Database1.Table1 and Database2.Table1 and then accordingly do inserts/updates/deleted on Database2.Table1?
    Thanks

    Karthick_Arp wrote:
    Do you have a DBLink? If youes you can do this.
    1. Login into the Database-2 and run this code.
    begin
    for i in (select table_name from user_tables)
    loop
    execute immediate 'truncate table ' || i.table_name;
    end loop;
    end;This will empty all the tables in your Database-2. Now what you need is to just populate the data from Database-1This might result in error, if any of the tables have referential integrity on them.
    From 10g documentation :
    Restrictions on Truncating Tables
    You cannot individually truncate a table that is part of a cluster. You must either truncate the cluster, delete all rows from the table, or drop and re-create the table.
    You cannot truncate the parent table of an enabled referential integrity constraint. You must disable the constraint before truncating the table. An exception is that you can truncate the table if the integrity constraint is self-referential.
    If a domain index is defined on table, then neither the index nor any index partitions can be marked IN_PROGRESS.I would go for normal MERGE. Also change the cursor to select table names by first modifying the child tables and then the parent table.

  • How to compare table in different versions?

    Hi,
    Please let me know how to comare table fields in different versions?
    Ex: I need to compare the table fields of version 4.5 with ECC6.0.
    Thank you.

    Hi,
      goto Se11 Transaction -> enter table -> display.
    Utilities ->Version -> version management
    now click on remote comparison -> enter target system.
    Regards
    Kiran Sure

  • Compare table structures in different schemas. help please

    Hi all,
    I have a question...
    I have tables on different schemas some thing like
    Schema A
    Table 1
    Table 2
    Table 3
    Schema B
    Table 1
    Table 2
    Table 3
    Now situation is Table 1 and Table 2 will have similar structure or Table 1 in Schema B will have additional columns.
    like so... on... for all other tables...
    example !
    Schema A:
    Desc Table 1;
    Name                                  Type            Null
    No                                Number            Notnull
    Name                           Varchar2(10)     Not null
    Fee                              Number (10,2)   Not null
    Scheam B;
    Desc Table1;
    Name                                  Type               Null
    DX_No                                Number            Notnull
    DX_Name                           Varchar2(10)      Not null
    DX_Fee                              Number (10,2)   Not null
    comments                          Varchar(2)        Now I need to write a procedure sort of thing to compare these tables which are in different in column names in both schema and get it exported to Excel sheet.
    and here thing is first three columns SHOULD BE TREATED AS SAME even though prefix of DX_ exist since REST OF THE PART OF COLUMN NAME IS SAME.
    and in same way commets is new coloumn in schema B only..So that should be highlighted excel sheets..
    I am not sure how OAD or SQL Developer handle this...Is there any plsql block I can write to do above..
    Thanks in advance..

    An example of one method (this is just a starting point, you'll have to build it out to suit your needs).
    create table emp as select * from scott.emp where 1=0;
    alter table emp add (junk number(1));
    select
          t1.column_name as t1_column_name
       ,  t2.column_name as t2_column_name
    from
       select column_name
       from
          dba_tab_columns
       where
          table_name  = 'EMP'
       and
          owner       = user
    ) t1
    full outer join
       select column_name
       from
          dba_tab_columns
       where
          table_name  = 'EMP'
       and
          owner       = 'SCOTT'
    ) t2
    on (t1.column_name = t2.column_name)
    where
       t1.column_name is null
    or
       t2.column_name is null;
    T1_COLUMN_NAME                 T2_COLUMN_NAME
    JUNK
    1 row selected.
    TUBBY_TUBBZ?If you need to remove prefix's ... you would just do that in the select list (using regexp_replace, translate, substr, whatever you think is appropriate for your situation).
    Edited by: Tubby on Nov 6, 2010 12:38 PM
    Forgot to mention that this code will report differences between two schemas, regardless of where the additional columns reside ... if you have a 'master' schema that is the definitive source, then you would want to use the query provided by Xtender.

  • Compare tables in two schemas for the table with particular column & value

    Hello All,
    I have a query to find out the list of table from a given schema to extract all the tables having a search column .
    ex :
    SELECT OWNER, TABLE_NAME, COLUMN_NAME FROM
    ALL_TAB_COLUMNS WHERE OWNER='<SCHEMA_NAME>'
    AND COLUMN_NAME='<COLUMN_NAME>'
    I want to compare two schemas for the same above query .
    Can we wirte a query on this - I am using SQL DEVELOPER , which has menu item - TOOL - database differneces to find the diffenence between two schemas but my requirement is to find the differences in two schemas for all the tables matching for a particular column ( as given in quer).
    Appreciate your help.
    thanks/Kumar
    Edited by: kumar73 on 29 Nov, 2012 1:50 PM

    Hi, Kumar,
    This is the SQL and PL/SQL forum. If you have a question about SQL Developer, then the SQL Developer is a better place to post it. Mark this thread as "Answered" before starting another thread for the same question.
    If SQL Developer has a tool for doing what you want, don't waste your time trying to devise a SQL solution. The SQL Developer way will probably be simpler, more efficient and more reliable.
    If you do need to try a SQL solution, then post some sample data (CREATE TABLE and INSERT statements for a table that resembles all_tab_columns; you can call it my_tab_columns) and the results you want from that data.

  • Compare table structure and add the missing columns

    Hello,
    I want to compare the table schema of two tables and update with some plsql code the second one with the missing columns of the fist one :
    Example
    SQL> desc a
    Name Type Nullable Default Comments
    C1 VARCHAR2(10) Y
    C2 NUMBER(3) Y
    C3 NUMBER(10,2) Y
    SQL> desc b
    Name Type Nullable Default Comments
    C1 VARCHAR2(10) Y
    C2 NUMBER(3) Y
    I want a script that will generate the following code
    alter table b add (c3 number(10,2))
    Thanks
    Andreas

    How abt the below mentioned code
    SQL>desc a
    Name Null? Type
    C1 VARCHAR2(30)
    C2 NUMBER(3)
    C3 NUMBER(10,2)
    C4 NOT NULL DATE
    C5 VARCHAR2(30)
    SQL>desc b
    Name Null? Type
    C1 VARCHAR2(30)
    SQL>ed
    Wrote file afiedt.buf
    1 Declare
    2 Cursor c1 is select Column_name,Data_length,Data_type,DATA_PRECISION,DATA_SCALE,
    3 Nullable
    4 From User_tab_columns
    5 Where Table_name = 'A';
    6 v_length Number;
    7 v_str Varchar2(200);
    8 v_null Varchar2(10);
    9 Begin
    10 For c2 in c1 loop
    11 Select count(1) into v_length
    12 From user_tab_columns
    13 Where Table_name = 'B'
    14 And Column_name = c2.column_name;
    15 if v_length = 0 Then
    16 Select Decode(c2.Nullable,'N','NOT NULL','') into v_null From Dual;
    17 if c2.Data_type = 'NUMBER' Then
    18 v_str := 'alter table b add '||c2.column_name||
    19 ' '||c2.data_type||'('||c2.data_precision||','||c2.data_scale||') '||
    20 v_null;
    21 Elsif c2.Data_type = 'DATE' Then
    22 v_str := 'alter table b add '||c2.column_name||
    23 ' '||c2.data_type||' '||v_null;
    24 Else
    25 v_str := 'alter table b add '||c2.column_name||
    26 ' '||c2.data_type||'('||c2.data_length||') '||v_null;
    27 End if;
    28 Execute immediate v_str;
    29 End if;
    30 End loop;
    31* End;
    SQL>/
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:04.03
    SQL>desc b
    Name Null? Type
    C1 VARCHAR2(30)
    C2 NUMBER(3)
    C3 NUMBER(10,2)
    C4 NOT NULL DATE
    C5 VARCHAR2(30)

  • How to compare table data available in two different databases

    Hi,
    I need to compare two tables data in available in two databases - how easly I can do that .. I have Table A in Database A and Table A in Database B which is snapshot of DB A.TableA - but here are some discrepencies now I need to match two tables .. but no extra space available, so no exp imp.
    Thanks in advance,
    Chitrasen

    HI,
    What is the difference that you are looking for, if it si for some records missing in some tables you could use MINUS and get the output. IF you are looking to compare the TABLE structure then you could look into the datadictionary VIEWS of both the database's and check the difference.
    Thanks

Maybe you are looking for

  • Every time when I connect my iphone to my pc, Itunes stops working

    When Itunes is activated on my pc, en then I connect my iphone tot de pc. First itues start syncup, then my computer give's an error, en itunes stops working. I already tried deïnstalling, en reïnstalling. But nothing works. Itunes alone works perfec

  • Need help trouble shooting Database Gateway for MS SQL Server setup, getting ORA-28546 error

    Dear All, I am trying to setup Oracle Database Gateway for MS SQL Server(I don't have admin access to the MS SQL Server).  When I try to test the dblink connection, I get the following error. I issued select * from dual@xyz; ORA-28546: connection ini

  • HELP... iPod 5th gen wont play on docking station

    We have 2 iPod 4th gen nano's and both play perfectly well on the docking stations, one being great quality one. The 5th gen nano plays but only with internal speakers even tho connected to docking station....Help.

  • Ical in the dock!!

    Hi people, Can anybody tell me why the date on the calendar in my dock always says 17th july just sfter start up? If i click on the icon it then changes to the correct date.I use a macbook pro with the last version of tiger! Im sure some of you guys

  • Custom Button Outlook to Word Bookmark

    Hello, Based on below thread how would I need to update the macro in order to open a word document at a specific bookmark created in the document? custom-button-outlook-2010 Thanks a lot for your help