Maintain Change log between two tables
Hi,
I have input data as below in two tables temp1,temp2.
I need to find the difference then maintain a change log as below;
so I need query to get output in this way;
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem.
you cannot have same name for two coloumns in a single select statment .
so name its with alias name such as colName and colName1
select T.colName as colName, T1.colName as ColName1 ,T.TableName as tableName, T1.TableName as tableName1 ,T.dataType as datatype, T1.Datatype as datatype1 , T.ColLength as column Lenghth, T1.colLength as Collength1,
(IF (T.colName = T1.colName and T.TableName and ...compare rest of the columns) THEN match
ELSE IF (T.colName <> T1.colName) THEN ColumNamechanged
ELSE IF (next colunm name) THEN changedcolname
ELSE
FROM temp1 T ,temp2 T1)
AS change
FROM temp1 T ,temp2 T1) as chages
from temp1 T ,temp2 T1 where T.colName = T1.colName ;
Similar Messages
-
Difference between Delta "Change Log" and "Active Table (Without Archive)"?
In BI7.0 environment, we perform our Delta loads (the DTP settings under the Extraction tab, there is a field called Extraction Mode and it's value is selected as "Delta") every day among all our DSOs.
There is a section called "Delta Init. Extraction From..." under the same tab in DTP, there are four radio buttons:
Active Table (With Archive)
Active Table (Without Archive)
Archive (Full Extraction Only)
Change Log
Then what is the difference between "Change Log" and "Active Table (Without Archive)" if both Extraction Mode is "Delta" for two Delta loads?
Thanks!Hi ,
The new options SP16 has are:(Chk Note 1096771)
Active Table (with Archive)
The data is read from the active table and from the archive or from a near-line storage if one exists. You can choose this option even if there is no active data archiving process yet for the DataStore object.
Active Table (Without Archive)
The data is only read from the active table. If there is data in the archive or in a near-line storage at the time of extraction, this data is not extracted.
Archive (Only Full Extraction)
The data is only read from the archive or from a near-line storage. Data is not extracted from the active table.
Change Log
The data is read from the change log of the DataStore object.
Delta will always be picked from change log table.Only during intialization you can choose between getting data from change log or active table.If you are doing the load first time and are initializzing delta in subsequent data targets, then pulling data from active table will get lesse volume of data then it would have got from change log table....All subsequent deltas will be picked up from the change log. And when we need to reload data into the data target (which would be a full load) - we use active table.
From change log : you can take below ones as targets
1) Cube 2) DSO with Addition as the update for the Keyfigures
From Active table: you can take below ones as targets
1) Cube ,if and only if, the records are never changes in the source once after creation
2) DSO with Addition as the update for the Keyfigures ,if and only if, the records are never changes in the source once after creation
3) DSO with Overwrite as the update for the Keyfigures ( incase deletions is not happening in the source system)
Pls check this link
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/e8c56ecd313c86e10000000a42189c/frameset.htm
Regards,
CSM Reddy -
Need to find the Difference between two table
Hello ,
I have stucked in program as below scenario:-
I have two tables of huge data of same structure in a same schema.I need to find the difference exact values in tables.
By using MINUS we can find the difference between two table ,i need to find the what exact difference in the there values with colunm and value at that column.
Example TableA
Col1 col2 col3 col4 col5.... col50
10 ABC 2001 EE 444 TT
40 XYZ 3002 RR 445 TT3
80 DEF 6005 YY 446 YY8
TableB
Col1 col2 col3 col4 col5.... col50
10 ABC 2001 EE 444 TT
40 XYZ 3002 RR 445 TT3
81 DEF 6005 Yu 447 YY8
I need to the out put like this :-
The Diffence between two table is
TableA.COL1=80 TableB.Col1=81, Different
TableA.Col4=YY TableB.col4=Yu,Different
TableA.Col5=446TableB.col5=447,Different
Please suggest me to write the pl/sql program for the same
thanx in advance
KKThanx friends for all your efforts
I have a sample code for the same,this will compare the two tables for single row in each table .
what r the modification needed for the multiple rows of values in the two tables??
Please suggest!!
CREATE OR REPLACE PROCEDURE test_compare
IS
TYPE t_col
IS
TABLE OF VARCHAR2 (30)
INDEX BY PLS_INTEGER;
l_col t_col;
j NUMBER := 0;
l_sql VARCHAR2 (2000);
col1 VARCHAR2 (30);
col2 VARCHAR2 (30);
val1 NUMBER;
val2 NUMBER;
status VARCHAR2 (30);
CURSOR c1
IS
SELECT column_id, column_name
FROM all_tab_columns
WHERE table_name = 'TEST1';
BEGIN
FOR i IN c1
LOOP
j := j + 1;
l_col (j) := i.column_name;
END LOOP;
FOR k IN 1 .. j
LOOP
l_sql :=
'SELECT '
|| ''''
|| l_col (k)
|| ''''
|| ', '
|| 'TEST2.'
|| l_col (k)
|| ', '
|| ''''
|| l_col (k)
|| ''''
|| ', '
|| 'TEST1.'
|| l_col (k )
|| ', '
|| 'DECODE(TEST2.'
|| l_col (k)
|| ' -TEST1.'
|| l_col (k)
|| ', 0, ''NO CHANGE'', ''CHANGED'') FROM TEST2, TEST1';
EXECUTE IMMEDIATE l_sql INTO col1, val1,col2, val2, status;
IF status = 'CHANGED'
THEN
DBMS_OUTPUT.put_line( 'TEST2.'
|| col1
|| '='
|| val1
|| ', TEST1.'
|| col2
|| '='
|| val2
|| ', '
|| status);
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error:- ' || SQLERRM);
END;
/ -
Matching change log between ODSs
This may be impossible. But here goes goes anyway.
Background:
We are doing SD extraction. There are two ODSs involved in this issue.
1) One for VAITM (Sales Order Line Items)
2) One for VAKON (Sales Order Line Item Conditions).
If a user changes a condition in a line item or the line item, change records are written to both VAKON and VAITM.
Issue:
What I've been asked to do is that for any given change record in VAKON, read the corresponding change record in VAITM.
So my question is, Is there a way to correlate change records between two ODSs?Praveen,
I am attempting to do this match in BADI attached to a transformation of an infospoke that has the VAKON ods as the source.
This is a delta run, so I need to match the change record coming in from VAKON to the corresponding VAITM change record.
The technical keys to the change logs are REQUEST, DATAPAKID, and RECORD; both of course having different values.
Thats the challenge. I can't go against the active data. I want the value of several fields in VAITM at the time of the change for the VAKON feed in the infospoke.
Thanks for your help though. It is much appreciated. -
How to compare data between two tables?
Hi,
My team is trying to develop a SAP data migration tool (DMT) using ABAP.
One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
Any help would be greatly appreciated, thanks!Hi Kian,
Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
Thanks,
Vinay -
How to find the structural difference between two tables
Hi all,
How to find the structural difference between two tables .
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Thanks,
P Prakashyou could try something similar to this, for each table pair that you want to compare:
SELECT 'TABLE_A has these columns that are not in TABLE_B', DIFF.*
FROM (
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_A'
MINUS
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_B'
) DIFF
UNION
SELECT 'TABLE_B has these columns that are not in TABLE_A', DIFF.*
FROM (
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_B'
MINUS
SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
FROM all_tab_columns
WHERE table_name = 'TABLE_A'
) DIFF;that's assuming, column_name, data_type and data_length are all you want to compare on. -
How to write select statement between two tables
hi,
i need to do comparision between two table for each records.ex:
table1:
regid regno ind
1 1001
1 1002
1 1003
1 1004
and table2:
regid regno
1 1002
1 1005
i need to select first row from table and loop for values in second table, if the values found first record , the record must update 'yes' to ind, if not 'No'.
please help with this.
thanks in advance
rajaHi Raja,
Do it like this. loop the first table and read the second table.
Use where condition to satisfy the conditions.
Or
In your select query use joins. Like this.
SELECT mara~matnr
marc~werks
INTO TABLE t_material
FROM mara AS mara INNER JOIN marc AS marc
ON maramatnr = marcmatnr
WHERE mara~mtart = p_mtart.
Instead of MARA and MARC here use your tables.
Much Regards,
Amuktha. -
I need to implement Drag N Drop between two tables which saves both records
I need to implement Drag N Drop between two tables which saves both records in a third page, by using drag n drop.
check this video http://baigsorcl.blogspot.com/2011/01/drag-and-drop-collection-in-oracle-adf.html
-
How to build "Greater/less or Equal" relationships between two tables?
Hi,
Is there any straightforward approachs to realize the following kind of relationships between two tables?
Table1.process_end_date >= Table2.work_start_date and
Table1.process_end_date <= Table2.work_end_date
BTW, there's no common columns for these two tables to do simple joins (inner, outter...).
Thanks.
Regards,
QilongSure.
Table.SelectRows filters a given table (in this case Table2) based on a function provided as the second argument.
(table2Row) => is the start of our filter function. It defines a function that takes one argument, called table2Row. Each row of Table2 will be passed to this function. If the function returns true, the row will be kept. If the function returns false,
the row will be filtered out.
The right hand side of the => is the filter expression. Because we're adding the custom column to Table1, we can reference a field in the current row of Table1 using square brackets (e.g. [process_end_date]). To reference the fields in the current row
of Table2, we have to index into the table2Row variable passed to our function (e.g. table2Row[work_start_date]).
Hope that helps.
Ehren -
Query the data between two tables
Need help for query the data between two tables
Table 1: Time sheet
P.ID P.Name EmpID HoursSpend DateTime
c12234 Test 25 4 06/12/2013
c12234 Test 25 7 06/13/2013
c12234 Test 25 8 06/15/2013
c12234 Test 5 3 06/21/2013
c12234 Test 2 5 07/15/2013
c12234 Test 25 4 07/21/2013
Table 2: cost table
EmpID FromDate ToDate Rate
25 05/01/2013 06/30/2013 250
2 04/01/2013 05/31/2013 150
25 07/01/2013 09/30/2013 300
Output
P.ID P.Name EmpID HoursSpend DateTime Rate Total (HoursSond x Rate)
c12234 Test 25 4 06/12/2013 250 1000 (4*250)
c12234 Test 25 7 06/13/2013 250 1750
c12234 Test 25 8 06/15/2013 250
2000
c12234 Test 25 4 07/21/2013 300
1200
c12234 Test 2 5 07/15/2013 150
750
===========================================
Total 28
6700
============================================
Here EmpID =2 don't have rate in the cost table on july month should be pick from last entry from cost table.Hi Gopal,
According to your description, it seems that the output needn’t include the row when EmpID=2. Because the DateTime for it in Table1 doesn’t included between FromDate column and ToDate column. After testing the issue in my environment, we can refer to the
query like below to achieve your requirement:
SELECT time.*,cost.EmpID,cost.Rate,(time.HoursSpend * cost.Rate)as [Total (HoursSond x Rate)]
FROM [Time sheet] as time
INNER JOIN
[cost table]as cost
ON time.EmpID = cost.EmpID
AND time.DateTime BETWEEN cost.FromDate AND cost.ToDate
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Subject: How to do join between two tables using something like SE16
SE16, SE11 provide form based interface query information from a single table. Is there a way to do join between two tables without creating an infoset erc? I am looking for something similar to sql join but in SAP BI 7.0
Thanks.Hi
Pls look into below links. Hope this helps you.
1. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45bf455611d189710000e8322d00/content.htm
2. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45a5455611d189710000e8322d00/content.htm
Regards
Sirigiri -
How to give relationship between two tables with comon column with between oprator
Hi Folks,
I am using Sql Server 2008R2. I am getting a problem to establish relationship between two tables.
I have two Tables, 1.Inventory Details Table another one is Inventory Header Table.
Inventory Details Table having a column Card No and inventory Header Table having columns From card No and To Card No.
I want to give relationship between these two tables with Card no. Could you please provide me the Sql Query.
Your help would be greatly appreciated .
Regards
hasthi.
email:[email protected]Hi Raju,
We have two way that we can relate to the table either join or quality condition use following syntax/Query for relating two tables
select * from Inventory_Details ID inner join Inventory_Header IH on ID.CardNo between IH.FrmCardno and IH.ToCardNo
or
Select * from Inventory_Details ID ,Inventory_Header IH where ID.CardNo=IH.CardNo OrSelect * from Inventory_Details ID ,Inventory_Header IH where ID.CardNo between IH.FrmCardno and IH.ToCardNo
Hope this will help you
Niraj Sevalkar -
How to check relation between two tables in same database
How to check relation between two tables in same database using Oracle SQL developer. Version 2.1.1.64
Hi,
Try this,
SELECT cons.owner AS child_owner, cons.table_name AS child_table,
cons.constraint_name constaint_name,
cons.constraint_type constraint_type, col.owner parent_owner,
col.table_name parent_table, col.column_name column_name
FROM dba_cons_columns col, dba_constraints cons
WHERE cons.r_owner = col.owner
AND cons.r_constraint_name = col.constraint_name
AND col.owner = 'MY_USER'
ORDER BY child_table;Thanks,
Shankar -
Relationship between two tables
Hi,
Can some one tell me how can i find the relationship between two tables in CRM. is there any transaction for the same. Is it possible to see the data model.
Thanks
Akila.RHi Nishant ,
Could you please explain brief about the Data relationship ......??
I can see the Foreign Key & Check Table relation in se11 .
Since I am in the Analysing phase ,
what are all the details can i get from Foreign Key & Check table kind relations ...??
Thanks
Rgds
Ganesh -
Transaction to see common data between two tables
Is there any transaction to see common data between two tables with out creating views.
what is the transaction to see the link between two tables
regards
pavanHi,
Go to a transparent table for which you want to know the common fields, from there click the button GRAPHICS (shortcut Ctrl + Shift + F11) in the application tool bar. Then you are redirected to a list containing the tables belonging to the same group. There select whatever tables you would like to see and click COPY. A window will pop-up and will show the relationship between the fields of the tables in a flow chart format.
see to this link also.
Common fields b/w tables
Regards,
Revathi Bhoopal.
Maybe you are looking for
-
Brother HL-4070CDW will not set up to print on my network
It would appear that the printer drivers for Brother HL-4070CDW color laser are not installing. Either that, or the computer is failing to acknowledge they're there. I followed the instructions to install drivers from the Brother CD and then also ins
-
W500: Dead Ethernet Port
Today my ethernet port stopped working. While Linux can see it (I'm running a brand new install of Linux Mint 14), and it appears to attempt to connect, I cannot acquire an IP address and connect to any network. I've verified that the ethernet cabl
-
FX Brushes won't allow paint on for Sharpness or brightness etc.
Hi! I am a photographer- looking for a fun phone app. I have played with the FX brushes on an image. I can paint on black and white (after I select the brush on the left then the effect from the bottom options) but doing the exact same process, I ca
-
Imap authentication fail error - cannot email pdf
!I installed acrobat XI about 6 months ago and still have not been able to figure out how to get it to send a pdf other than closing it. Copying it from file location and then posting in an amail. HIGHLY ANNOYING!!! When i try send directly from open
-
BAM-00553: Resources start operation for destination jms/BAMTopic failed
Hi , im trying to subscribe to a JMS topic created in a different machine(OSB+weblogic) from BAM Enterprise Message sources .Bam is intalled in a different machine along with soa suite. when i try to subscribe to that topic im facing this issue BAM-0