DELETE THE MATCHED RECORDS IN DB2 TABLE
DELETE THE MATCHED RECORDS IN DB2 TABLE
sql server table sqlserver_emp(c1,c2,c3,4)
records:1 2 3 4
DB2 table db2_emp(c1 key,c2,c3,c4)
records:1 2 5 6 7 8
Both tables having same structure
Matched records : 1 2
1.Delete the matched records in db2 table : 1 2 (without using truncate option for DB2 in Anywhere)
2.Finally Load all records in sql server(Because duplicate records in db2 already removed so no duplicates occured)
3.NEED final OUTPUT AS:db2 table: 5 6 7 8 1 2 3 4
Note:
1.DB2 truncate doesn't used
2.STARING AREA: ORACLE
3.SQLSERVER AND DB2 CLOSED ENVIRONMENT DOESN'T USED AS STAGING AREA.
HOW MANY INTERFACES AND PROCEDURES SHOULD BE CREATE? WHAT ARE THEY?
HOW TO REACH MY REQUIREMNT?
Answer provider is more appricatable.
Thanks in advance.
Edited by: krishna on Nov 9, 2011 8:40 PM
1st option
See in this scenario you can use two interface and one procedure step.
1st interface-->poricedure-->2nd interface
1st interface will bring data to oracle staging-->then procedure will delete matched record from target using keys--->3rd interface will simple insert the the data in oracle staging.
2nd option
Insted of deleting the target matched records, you just update target matched record with latest records in your staging oracle.You can use IKM Merge
Thanks
Similar Messages
-
How to delete the duplicate records in a table without promary key
I have a table that contains around 1 million records and there is no promary key or auto number coulums. I need to delete the duplicate records from this table. what is the simple effective way to do this.
Please see this link:
Remove duplicate records ...
sqldevelop.wordpress.com -
Delete the parent records and child table records at a time
hi all;
I am facing the pbm like to delete the all records in child table and corresponding records in parent table at a time. so I want to delete the all the records in child table and corresponding parent records in parent table by using single SQL query. plz help me
Thanks in advanceYou want to use one single SQL statement to delete the child records in a table and the corresponding master records in the master table??
That's not quite possible with a single SQL, of course unless you are talking about Oracle Forms, where you have a relation and set the delete behavior to Cascading, like said in the above posts.
Tony -
How to delete the matching records from two internal tables
Hi ,
I have two internal tables say A and B of the same type. If A has 10 records and B has 4 records , I want to delete the 4 records in B from A .
loop at B into wa .
delete A where key = wa - key .
endloop.
takes a long time if the table B is huge. how can I improve the performance.
Thanks.
GayathriHi Gayathri,
You could try field-symbols. It reduces the data transfer from the internal table B to the work area.
field-symbols <fs_itab_b> like line of B.
loop at B assigning <fs_itab_b>.
delete A where key = <fs_itab_b>?-key.
endloop.
Regards,
<a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=zwcc%2fwm4ups%3d">anand Mandalika</a>. -
I want to delete the transactional record from database table
Hai,
I want to delete the transactional data from database table with out using the dialog programming is it there any trancation for this.
for master data we have the transaction code for delete the records. The t.code is 'OBR2'.
Plz help in that cse.
Thanks and regards,
P.Naganjana ReddyHai,
Plz help me urgent.
I am asking i want to delete transactional data from database table without using the dialog programming.
Thanks and Regards,
P.Naganjana -
How to Delete the condition record in CRM
HI,
Can you please help me how to delete the condition record from condition table in CRM.
Please explain the usage of FM CRMXIF_CONDITION_SEL_DELETE with examples.
I have also read the documention of the function module. How to use this FM for custom defined condition table.
(this is the code given in Documentation)
DATA-OBJECT_REPRESENTATION = 'E'
DATA-SEL_OPT-CT_APPLICATION = 'CRM'
DATA-SEL_OPT-OBJECT_TASK = 'D'
DATA-SEL_OPT-RANGE-FIELDNAME = 'PRODUCT_ID'
DATA-SEL_OPT-RANGE-R_SIGN = 'I' (Including)
DATA-SEL_OPT-RANGE-R_OPTION = 'EQ'
DATA-SEL_OPT-RANGE-R_VALUE_LOW = 'PROD_1'
Thanks
ShankarHi Shankar,
I am using the same CRMXIF_CONDITION_SEL_DELETE function module to delete condition record present in CRM.
But it is giving me below error in the return table of the FM after i run the program. Can you please correct me if I am doing any thing wrong?
Error in lt_return: SMW3 CND_MAST_SEL_DEL_EXT_VALIDATE CND_M_SD
code:
ls_range-fieldname = 'PRODUCT_ID''.
ls_range-R_SIGN = 'I'.
ls_range-R_OPTION = 'EQ'.
ls_range-R_VALUE_LOW = '123456'.
APPEND ls_range TO lt_range.
MOVE lt_range TO ls_entry-SEL_OPT-range.
ls_data-SEL_OPT-object_task = 'D'.
ls_data-SEL_OPT-ct_application = 'CRM'.
ls_data-object_representation = 'E'.
CALL FUNCTION 'CRMXIF_CONDITION_SEL_DELETE'
EXPORTING
DATA = ls_date
IMPORTING
RETURN = lt_return
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
IMPORTING
return = lt_ret.
Edited by: Saravanaprasad Nadar on Jul 7, 2010 1:27 AM -
Delete the matched, then insert
Hi,
I want to implement a loading situation like this: When there is match, delete all matched records, then insert the new record into the table.
I used delete/insert operator property by specifying one attribute for delete match. But it ended up delete all records in the table and insert the new records, instead of just delete the matched.
Is there loading type or operator property that allows me to handle this in mapping without going through transformation? Thanks
TracyHello Tracy,
As you have noticed there is little difference between DELETE/INSERT and TRUNCATE/INSERT (main difference is that the former allows rollback in case of failure, the latter more efficient).
There is no way to archive what you want in OWB 10R1 in a single mapping (unless cheating and doing everything in PL/SQL!).
You can split your problem into two separate mappings:
1) delete all records from your target that match your source
2) insert your source records into the target
Alternatively, you can
1) delete all records from your target that match your source except one (using eg. ROWID)
2) update your target with source rows
Regards, Hans Henrik -
How to delete the duplicate data from PSA Table
Dear All,
How to delete the duplicate data from PSA Table, I have the purchase cube and I am getting the data from Item data source.
In PSA table, I found the some cancellation records for that particular records quantity would be negative for the same record value would be positive.
Due to this reason the quantity is updated to target but the values would summarized and got the summarized value of all normal and cancellation .
Please let me know the solution how to delete the data while updating to the target.
Thanks
Regards,
SaiHi,
in deleting the records in PSA table difficult and how many you will the delete.
you can achieve the different ways.
1. creating the DSO maintain the some key fields it will overwrite the based on key fields.
2. you can write the ABAP logic deleting the duplicate records at info package level check with the your ABAPer.
3.you can restrict the cancellation records at query level.
Thanks,
Phani. -
How to delete the single record from the ODS
HI,
I want to DELETE the particular record from ODS.. how to delete that..
plz give me the solution.. it's urgent..
with regards
@jayHi Prakash,
You can delete a particular record from ODS by specifying the key field name in Selective deletion button available in Contents tab in the manage screen of ODS. But it will only delete the record from the active data table and not from the Change log and new data table . You should be very carefull if you are doing in Production system as there is chance of deleting other records accidentally.
Go to Selective deletion button - > Click on delete selection -> Enter the key field values of the record you want to delete-> Press save button to save as Variant -> Go back and click on selection button -> Chosse the background job type -> Click on start button.
Regards,
Prakash -
To find the duplicate record in internal table
Hi,
i have a requirement to fine the duplicate record with 3 fields.
i am getting a flat file with 15 fields .
i need to check the duplaicate records of 3 fields . if i get any 2nd same record of 3 fields , the records will go to other internal table.
for ex :
1. aaa bbb ccc ddd eee fff ggg hhh
2. aaa bbb ccf dde edd ffg ggh hhj
3. aaa bbb cce ddd ees ffh ggu hhk
in that 1st record and 3rd record are same (aaa bbb ddd)
i need to find 3rd record
please help me
regrards
srinivasuhi,
itab2[] = itab1[].
sort itab1 by f1 f2 f3.
sort itab2 by f1 f2 f3.
delete itab2 index 1. "to delete the first record in itab2.
loop at itab1 into ws_itab1.
loop at itab2 into ws_itab2.
if ws_itab1-f1 = ws_itab2-f1 and
ws_itab1-f2 = ws_itab2-f2 and
ws_itab1-f3 = ws_itab2-f3.
ws_itab3 = ws_itab2.
append ws_itab3 into itab3. "Third internal table.
endif.
endloop.
delete itab2 index 1.
endloop.
ITAB3 will have all the duplicate records.
Regards,
Subramanian -
Delete 50 Million records from a table with 60 Million records
Hi,
I'm using oracle9.2.0.7 on win2k3 32bit.
I need to delete 50M rows from a table that contains 60M records. This db was just passed on to me. I tried to use the delete statement but it takes too long. After reading the articles and forums, the best way to delete that many records from a table is to create a temp table, transfer the data needed to the temp table, drop the big table then rename temp table to big table. But the key here is in creating an exact replica of the big table.I have gotten the create table, indexes and constraints script in the export file from my production DB. But in the forums I read, I noticed that I haven't gotten the create grant script, is there a view I could use to get this? Can dbms.metadata get this?
When I need to create an exact replica of my big table, I only need:
create table, indexes, constraints, and grants script right? Did I miss anything?
I just want to make sure that I haven't left anything out. Kindly help.
Thanks and Best RegardsCan dbms.metadata get this?
Yes, dbms_metadata can get the grants.
YAS@10GR2 > select dbms_metadata.GET_DEPENDENT_DDL('OBJECT_GRANT','TEST') from dual;
DBMS_METADATA.GET_DEPENDENT_DDL('OBJECT_GRANT','TEST')
GRANT SELECT ON "YAS"."TEST" TO "SYS"
When I need to create an exact replica of my big table, I only need:
create table, indexes, constraints, and grants script right? Did I miss anything?
There are triggers, foreign keys referencing this table (which will not permit you to drop the table if you do not take care of them), snapshot logs on the table, snapshots based on the table, etc... -
DB Adapter polling : Not deleting the read records
Hi,
I have a simple BPEL process to poll a database table to delete records after reading them.I tried testing by inserting a single record into the table.BPEL is simply creating new instance (as it is not deleting the read records).
I am using fusion middleware version 11.1.1.3.0.
Also i am not able to view flow trace.I see a row under flow trace but there is no link to open audit trail or flow page.How to enable this.
thanks,
ashokHi Naresh,
Here is the contents of jca file:
<adapter-config name="readDB" adapter="Database Adapter" wsdlLocation="readDB.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
<connection-factory location="eis/DB/ArbonneProd" UIConnectionName="ArbonneProd" adapterRef=""/>
<endpoint-activation portType="readDB_ptt" operation="receive">
<activation-spec className="oracle.tip.adapter.db.DBActivationSpec">
<property name="DescriptorName" value="readDB.CustomersToOracle"/>
<property name="QueryName" value="readDBSelect"/>
<property name="MappingsMetaDataURL" value="readDB-or-mappings.xml"/>
<property name="PollingStrategy" value="DeletePollingStrategy"/>
<property name="PollingInterval" value="10"/>
<property name="MaxRaiseSize" value="1"/>
<property name="MaxTransactionSize" value="10"/>
<property name="NumberOfThreads" value="1"/>
<property name="ReturnSingleResultSet" value="false"/>
</activation-spec>
</endpoint-activation>
</adapter-config>
Under trace i see below record:
Instance Type Usage State
ReadDB of service:<instanceid> JCA Adapter Service Completed -
hi all,
based on the thread i got the list of child tables.
Re: to find the tables which is having link with particular table.
no i have doubt in deletion process.
My ultimate aim is to delete the bl_det records.
let me explain with ex.
i have table
BL_DET --parent table with comp and ref as primary key
which is having child rec.
BL_CON --child of BL_DET(comp,ref) primary key comp,ref and serial
BL_CON_PCK --is child of BL_CON(comp,ref,serial) primary key comp,ref,serial,pck_gp_srl,gp_srl.
DELETE BL_CON_PCK
WHERE BCK_COMP = :GLOBAL.comp
AND BCK_REF = :parameter;
DELETE FROM BL_CON
WHERE BCR_COMP = :GLOBAL.comp
AND BCR_REF = :paramter
DELETE FROM BL_DET
WHERE BL_COMP = :GLOBAL.comp
AND BL_REF - :parameterwill delete the correct set of records.(my doubt area is delete statement written for the table BL_CON_PCK).
Please tell me if i am wrong.
Thanks..(my doubt area is delete statement written for the table BL_CON_PCK).Cannot understand your doubt. What is your doubt, are you getting any error while executing your code?
To delete a record from parent table all child references must be deleted. So your delete statement appears right
-- How delete should progress
BL_CON_PCK >> BL_CON >> BL_DET
{code}
If you have created foreign constraint using ON DELETE CASCADE or ON DELETE SET NULL then you can straight away delete from parent table and all child references are deleted/set as null respectively. Read Oracle Documentation to see details
Short demonstration
{code:sql}
SQL> CREATE TABLE A(a1 NUMBER PRIMARY KEY , a2 NUMBER);
Table created
SQL> CREATE TABLE B(b1 NUMBER PRIMARY KEY , a1 NUMBER);
Table created
SQL> CREATE TABLE C(c1 NUMBER, b1 NUMBER);
Table created
SQL> ALTER TABLE B ADD CONSTRAINT FK_B FOREIGN KEY (a1) REFERENCES A ON DELETE CASCADE;
Table altered
SQL> ALTER TABLE C ADD CONSTRAINT FK_C FOREIGN KEY (b1) REFERENCES B ON DELETE CASCADE;
Table altered
SQL> INSERT INTO A VALUES (1,2);
1 row inserted
SQL> INSERT INTO B VALUES (3,1);
1 row inserted
SQL> INSERT INTO C VALUES (4,3);
1 row inserted
SQL> SELECT * FROM A;
A1 A2
1 2
SQL> SELECT * FROM B;
B1 A1
3 1
SQL> SELECT * FROM C;
C1 B1
4 3
SQL> DELETE FROM A WHERE A1=1;
1 row deleted
SQL> SELECT * FROM A;
A1 A2
SQL> SELECT * FROM B;
B1 A1
SQL> SELECT * FROM C;
C1 B1
{code} -
To find matching records across two tables
Hi folks,
I have a question regarding modifying the query. I am trying to compare the data between two tables, there are matching records in two tables, but are not in the same order. How to modify the query so that it finds the matching record between the two tables?
Here is my code
loop at itab_A.
read table itab_B with key
employeenumber = itab_zmgr_training-empid binary search.
if sy-subrc = 0.
Any thoughts?
Thanks,
Sk
Here I am getting the return value as '4'I have tried all that, but why is it that while reading a record from itab_B I see no record in the header line,
Let me paste the entire code of what I am trying to achieve.
data: itab_A like A occurs 0 with header line.
data: itab_B like B occurs 0 with header line.
some validation.....
loop at itab_A.
read table itab_B with key employee number = empid binary search.
if sy-subrc =0.
per form validation.
else.
perform validation.
endif.
endloop.
My observation: while reading recrod from itab_B the header line is clear, no record is read here hence sy-subrc = 0.
How can I correct this? Since it is not reading any record from itab_B no matching record is found.
Any thoughts would be really helpful.
Thanks,
Santhosh. -
Performance issue - insert records from db2 tables
I have a table say emp in oracle database and i have the emp table in db2 database. My job is to pull all the records (million records) from db2 table to oracle emp table. My insert statement is like below. I am connecting to the db2 database using dblink.
insert into emp
select * from emp_db2, dept_db2
where emp_db2.dno = dept_db2.dno
and dept_db2.dno = 10;
The statement is still running. How to improve the performance ?
please suggest.
thanks,
VinodhVinodh2 wrote:
1.how much is your select query is taking? 1 day over . still running.
2.What is the row count from the query? 85632978 records
3.Whats your expected completion time? 30 minutes
I am not getting the explain plan because the query is still running.
do as below
SQL> set autotrace traceonly explain
SQL> select sysdate from dual;
Execution Plan
Plan hash value: 1388734953
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 (0)| 00:00:01 |
| 1 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
-----------------------------------------------------------------
Maybe you are looking for
-
Hello, I have two iphones but one Apple ID. How can I use localization apps for a dedicated device? Tx
-
I have Windows 7 OS on my desktop. I had trouble with IE9 loading a shoutbox in a Carers Forum I belong to. I loaded Firefox and it allowed me to use the shoutbox okay. But when I tried to access the games aracade it told I needed to download Adobe F
-
Question Summary: How do I set the p-bit (COS value) for multicast traffic ingressing on an interface? Additional details: Although I have had success matching all IP traffic ingressing from the encoder/streamer (multicast source) I want to match onl
-
Call ABAP program from a process chain
Hi , Can anyone tell me how do we call an ABAP program in R3 from a process chain in BW. Its real urgent please help. Thanks Ankit
-
I did something yesterday to mess up my Mac. I did two things that could be the problem. Yesterday I finally got some motivation to download some music on this ridiculously long list of mine. I usually buy the music I like, but I test it out first by