Difference between MERGE and Update/Insert
Can anybody pls tell me what is the difference between MERGE and Update/Insert statements.
hi vivek,
merge is totally different than normal update and insert.Merge is a combination of update+inserrt.
Merge statment first checks the data in your table, if data is already exists then it will try to update the data otherwise it will go for insertion.In case of normal update/insert it will not check the data directly it does the specified operation.
So based on your requirement you have to select the best option.
Thanks.
Similar Messages
-
What is difference between modify and update i am using
hi
what is difference between mofify and update
my requiremen is to have three condition checkec while mofifying or updating from a internal table
the three fields are
cus no
status
date these all are primary key in the database table
so which sould i use modify or update
there might be entry already existing in database table or new entry to be created if already existin it should check on the primary keys and updatat if not it should add a record
pls suggest whihc to use and how to implement the check on teh threee primary key
like if modify ztable from table it_test
now where condition ? can be used or not with modify? and if yes how
if not should i use update will update create a new entry if no entry is there and please give syntex
regards
AroraHi Nishant Arora,
Modify: It works in performing two actions.
They are: Insert + Update.
For Example If a record that is exited in database, so you are modifying that record, it updates that particular record.
Similarly, If the is not existed in the database, you are modifying it, it inserts a new record.
Update: Update means just it updates the status, I mean it only updates the record. It doesn't inserts any new record if that particular record is not present in the database.
These are the cases you need to write these statements.
Syntaxes: :
Go through this links please.,
http://help.sap.com/saphelp_nw04/helpdata/en/e7/968aa8b2384dd9835f91e7f8470064/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35eb358411d1829f0000e829fbfe/content.htm
Reward points if useful
Cheers,
Swamy Kunche
Edited by: Swamy Kunche on Jun 11, 2008 2:41 PM -
What si the difference between crete and create insert operations.
Hi
In ADF 11g,what is the difference between create and createinsert operations.
if anyone knows plz tell me.Any document about this plz provide me.
Any help is appreciated.
Sailaja.Hi,
CreateInsert: Creates a new row that becomes the current row, and inserts the
new blank row into the data source.
Create: Creates a new row that becomes the current row, but does not insert it.
--> normaly you would use createinsert
Doc you can find here (search for Createinsert): http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974.pdf
br
Peter -
Whats difference between SDK and update eg 1.1.3
Can someone explain to me what the difference is between the SDK that is due at the end of this month and updates for example 1.1.3?
SDK stands for Software Developer Kit. It is not an update to the Iphone, it's an "instruction toolkit" (for lack of a better word) so to speak that will allow programers to create native iPhone/touch applications that can be installed directly onto the phone/touch.
The calculator is a perfect example of a phone application. Using the SDK a developer could create a better calculator that has more functionality which you could then buy/download and install directly on the phone (this is /just/ an example).
Sorry jia, wrong reply ^^
Message was edited by: Yellowadept -
In jdbc adapter what is the difference between insert and update insert
in jdbc adapter what is the difference between insert and update insert
Edited by: katru vijay on Mar 22, 2010 7:43 AMPlease refer to this Link [Document Formats for the Receiver JDBC Adapter|http://help.sap.com/saphelp_nw04/Helpdata/EN/22/b4d13b633f7748b4d34f3191529946/frameset.htm]
Hope this helps.
Regards,
Chandravadan -
Data comparison and update/insert between two schemas in same database
Hi all,
I have requirement like this. In one database, i am having two users, user1 and user2. Both users is having same tables and structure wise also same. In user1, data will be populated by job.
Now, what i want to do is, i have to find out difference between user1 and user2 data and the Difference data will be updated/inserted into the user2.
Any ideas please...
Thanks in advance,
PalWill trigger help you ... ie. for every update/insert on user1 will do on user2-- it is heavy to do for all table...
--svmg -
Whats the difference between ALL and FIRST in Multi Inserting
SQL> Drop Table Sales;
Table dropped.
SQL> Drop Table Accounts;
Table dropped.
SQL> Drop Table Research;
Table dropped.
SQL> Create Table Sales As Select * From Emp;
Table created.
SQL> Create Table Accounts As Select * From Emp;
Table created.
SQL> Create Table Research As Select * From Emp;
Table created.
SQL> Truncate Table Sales;
Table truncated.
SQL> Truncate Table Accounts;
Table truncated.
SQL> Truncate Table Research;
Table truncated.
SQL> Select * From Sales;
no rows selected
SQL> Select * From Accounts;
no rows selected
SQL> Select * From Research;
no rows selected
SQL> Insert All
2 When Deptno=10 Then
3 Into Sales (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
4 When Deptno=20 Then
5 Into Accounts (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
6 When Deptno=30 Then
7 Into Research (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
8 Select * From Emp
9 .
SQL> /
16 rows created.
SQL> Select * From Sales;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-81 100 10
7839 KING PRESIDENT 17-NOV-81 100 10
7934 MILLER CLERK 7782 23-JAN-82 100 10
7999 ABCDEFGH JOB 7839 09-FEB-06 100 0 10
4 rows selected.
SQL> Select * From Accounts;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7901 SMITH CLERK 7902 17-DEC-80 100 20
7566 JONES MANAGER 7839 02-APR-81 100 20
7788 SCOTT ANALYST 7566 19-APR-87 100 20
7876 ADAMS CLERK 7788 23-MAY-87 100 20
7902 FORD ANALYST 7566 03-DEC-81 100 20
123 20
6 rows selected.
SQL> Select * From Research;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7499 ALLEN SALESMAN 7698 20-FEB-81 100 300 30
7521 WARD SALESMAN 7698 22-FEB-81 100 500 30
7654 MARTIN SALESMAN 7698 28-SEP-81 100 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 100 30
7844 TURNER SALESMAN 7698 08-SEP-81 100 0 30
7900 JAMES MANAGER 7698 03-DEC-81 100 30
6 rows selected.
SQL> Truncate Table Sales;
Table truncated.
SQL> Truncate Table Accounts;
Table truncated.
SQL> Truncate Table Research;
Table truncated.
SQL> Insert First
2 When Deptno=10 Then
3 Into Sales (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
4 When Deptno=20 Then
5 Into Accounts (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
6 When Deptno=30 Then
7 Into Research (Empno,Ename,Job,Mgr,Hiredate,Sal,Comm,DeptNo)
8 Select * From Emp
9 /
16 rows created.
SQL> Select * From Sales;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-81 100 10
7839 KING PRESIDENT 17-NOV-81 100 10
7934 MILLER CLERK 7782 23-JAN-82 100 10
7999 ABCDEFGH JOB 7839 09-FEB-06 100 0 10
4 rows selected.
SQL> Select * From Accounts;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7901 SMITH CLERK 7902 17-DEC-80 100 20
7566 JONES MANAGER 7839 02-APR-81 100 20
7788 SCOTT ANALYST 7566 19-APR-87 100 20
7876 ADAMS CLERK 7788 23-MAY-87 100 20
7902 FORD ANALYST 7566 03-DEC-81 100 20
123 20
6 rows selected.
SQL> Select * From Research;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7499 ALLEN SALESMAN 7698 20-FEB-81 100 300 30
7521 WARD SALESMAN 7698 22-FEB-81 100 500 30
7654 MARTIN SALESMAN 7698 28-SEP-81 100 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 100 30
7844 TURNER SALESMAN 7698 08-SEP-81 100 0 30
7900 JAMES MANAGER 7698 03-DEC-81 100 30
6 rows selected.Both inserting insert the same records then whats the difference between ALL and FIRST clause in multi insert DML
Khurram Siddiqui
[email protected]Hello
From the docs:
ALL
If you specify ALL, then Oracle evaluates each WHEN clause regardless of the results of the evaluation of any other WHEN clause. For each WHEN clause whose condition evaluates to true, Oracle executes the corresponding INTO clause list.
FIRST
If you specify FIRST, then Oracle evaluates each WHEN clause in the order in which it appears in the statement. For the first WHEN clause that evaluates to true, Oracle executes the corresponding INTO clause and skips subsequent WHEN clauses for the given row.
ELSE clause
For a given row, if no WHEN clause evaluates to true:
* If you have specified an ELSE clause, then Oracle executes the INTO clause list associated with the ELSE clause.
* If you did not specify an else clause, then Oracle takes no action for that row.
See Also:
"Multitable Inserts: Examples"
Restrictions on Multitable Inserts
* You can perform multitable inserts only on tables, not on views or materialized views.
* You cannot perform a multitable insert into a remote table.
* You cannot specify a table collection expression when performing a multitable insert.
* In a multitable insert, all of the insert_into_clauses cannot combine to specify more than 999 target columns.
* Multitable inserts are not parallelized in a Real Application Clusters environment, or if any target table is index organized, or if any target table has a bitmap index defined on it.
* Plan stability is not supported for multitable insert statements.
* The subquery of the multitable insert statement cannot use a sequence.
So given this the following example shows the difference:
SQL> CREATE TABLE dt_test_insert_base as select rownum id from dba_objects where rownum <=20
2 /
Table created.
SQL> CREATE TABLE dt_test_insert_1 (id number)
2 /
Table created.
SQL> CREATE TABLE dt_test_insert_2 (id number)
2 /
Table created.
SQL>
SQL> INSERT ALL
2 WHEN rownum <=15 THEN
3 INTO dt_test_insert_1 (id)
4 WHEN rownum >=10 THEN
5 INTO dt_test_insert_2 (id)
6 SELECT
7 ID
8 FROM
9 dt_test_insert_base
10 /
26 rows created.
SQL>
SQL> SELECT * from dt_test_insert_1
2 /
ID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
15 rows selected.
SQL> SELECT * from dt_test_insert_2
2 /
ID
10
11
12
13
14
15
16
17
18
19
20
11 rows selected.
SQL>
SQL> TRUNCATE TABLE dt_test_insert_1
2 /
Table truncated.
SQL> TRUNCATE TABLE dt_test_insert_2
2 /
Table truncated.
SQL>
SQL> INSERT FIRST
2 WHEN rownum <=15 THEN
3 INTO dt_test_insert_1 (id)
4 WHEN rownum >=10 THEN --This condition is ignored until the value of id is > 15
5 INTO dt_test_insert_2 (id)
6 SELECT
7 ID
8 FROM
9 dt_test_insert_base
10 /
20 rows created.
SQL> SELECT * from dt_test_insert_1
2 /
ID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
15 rows selected.
SQL> SELECT * from dt_test_insert_2
2 /
ID
16
17
18
19
20HTH
David -
What is the difference between merge down, merge visible, and flatten image?
Hello, what is the difference between merge down, merge visible, and flatten image?
Hi there,
Merge Down combines the layer below the currently selected layer and the selected layer together into one singular layer. The layer name will change to the name of the layer below the selected layer. In the screenshot below, I chose to Merge Down from the layer "Circle Top". As you can see, afterward I have a new layer named "Circle Below" that has both layers combined.
Merge Visible will merge all visible layers into one singular layer. Merge Visible will ignore any layer that has it's visibility toggled to "Off". In the example below, I have 4 layers, with the layer "Circle Below"'s visibilty set to "Off". After I choose Merge Visible, all of the layers are combined excluding "Circle Below".
Flatten Image will combine all of the layers into one "flattened" image or layer. You will be prompted to choose whether or not to discard hidden layers before doing so. If you choose "Ok" to discard hidden layers, Photoshop will ignore any layer with it's visibility toggled to "Off". If you choose "Cancel", Photoshop will cancel the flattening process. If you want the hidden layer included in the flattened image, you will have to toggle it's visibility to "On". The following screenshot is what a flattened image's layer pallete looks like:
I hope this helps! If you need further clarification on this let me know! : ) -
Under LAYER what is the difference between "merge layer" and "flatten Image?"
Under LAYER what is the difference between "merge layer" and "flatten Image?"
Merge Layers will combine the current layer with the one below it.
Flatten image will combine all layers into one composite image.. -
Whats the Difference between Wrapping and Inserting a subform?
Pardon me for asking what is probably a silly question. But what is the difference between wrapping and inserting a subform? Thank you very much in advance.
-When you insert a subform, a new subform that does not contain any form objects at the time of creation is added.
-When you have existing form objects that you decide at a later time in your designing process to be contained in a subform, you can wrap these existing form objects by a subform. -
What is the difference between qued delta update and serialized delta upda
what is the difference between qued delta update and serialized delta update?
Hi Ks Reddy,
Queued Delta:
In case of Queued delta LUW's are posted to Extractor Queue (LBWQ), by scheduling the V3 job we move the documents from Extractor queue to Delta Queue(i.e. RSA7) and we extract the LUW's from Delta Queue to BW side by running Delta Loads. Generally we prefer Queued Delta as it maintain the Extractor Log which us to handle the LUW's which are missed.
Direct Delta:
In case of Direct Delta LUW's are directly posted to Delta Queue(i.e. RSA7) and we extract the LUW's from Delta Queue to BW side by running Delta Loads. If we use Direct Delta it degrades the OLTP system performance because when LUW's are directly posted to Delta Queue (RSA7) the application is kept waiting untill all the enhancement code is executed.
Non-serialized V3 Update:With this update mode, the extraction data for the application considered is written as before into the update tables with the help of a V3 update module. They are kept there as long as the data is selected through an updating collective run and are processed. However, in contrast to the current default settings (serialized V3 update), the data in the updating collective run are thereby read without regard to sequence from the update tables and are transferred to the BW delta queue.
https://websmp102.sap-ag.de/~sapdownload/011000358700007535452002E/HOWTOCREATEGENERICDELTA.PDF (need id)
http://help.sap.com/saphelp_bw33/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/frameset.htm
Business Intelligence Performance Tuning [original link is broken]
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cccad390-0201-0010-5093-fd9ec8157802
How to load data
/people/sap.user72/blog/2004/12/16/logistic-cockpit-delta-mechanism--episode-one-v3-update-the-145serializer146
/people/sap.user72/blog/2004/12/23/logistic-cockpit-delta-mechanism--episode-two-v3-update-when-some-problems-can-occur
/people/sap.user72/blog/2005/01/19/logistic-cockpit-delta-mechanism--episode-three-the-new-update-methods
Delta Types and methods;�
Hope this helps.
****Assign Points if Helpful*****
Regards,
Ravikanth -
Which one is faster loading type between Insert/Update and Update/Insert?
Hi Gurus,
Could anyone tell me which loading type faster between Insert/Update and Update/Insert?Any resolution and document reference would be grateful.
Regards,
Joni910575 wrote:
Thanks Purvesh for your quick response..
Yes you are right, we have to prefer sql rather than plsql. But if i have 1 lakh records to be inserted then my insert into select will do insert one by one that mean context switching is more to server i.e 1 lakh.
If i use BULK COLLECT+ FORALL then in a single switch the lakh records will be inserted right?
I agree that when we have less number of records to insert we can prefer insert into select, if we have huge data then why not FORALL ?
You have just tested for 107 records, but in huge data it is different right?
Thanks,
VinodYou've misunderstood how it works, I think. When you do the "insert into ... select", Oracle works out what rows need to be inserted and does them in one fell swoop. That's 2 context switches only, with the bulk of the work being done by the SQL engine.
When you do the BULK COLLECT + FORALL, you're telling Oracle to first identify the rows (that's two context switches straight off; one from PL/SQL to SQL and then back to PL/SQL again), load them into a collection, then loop through the collection and insert the records X rows at a time (which could be all records or whatever you set as the LIMIT on the FORALL) (again, with the context switching between PL/SQL and SQL and back again through each loop).
Which one sounds like it does the least amount of work? Not the BULK COLLECT, right? -
Difference between the synchrous update and asynchrous update
Hi all,
Can anybody explain the me the difference between the synchrous update and asynchrous update with some example.
Thanks in advance
RamyaHi,
Message: A Asynchronous updating. In this mode, the called transaction does not wait for any updates it produces to be completed. It simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster execution of your data transfer program.
Asynchronous processing is NOT recommended for processing any larger amount of data. This is because the called transaction receives no completion message from the update module in asynchronous updating. The calling data transfer program, in turn, cannot determine whether a called transaction ended with a successful update of the database or not.
If you use asynchronous updating, then you will need to use the update management facility (Transaction SM12) to check whether updates have been terminated abnormally during session processing. Error analysis and recovery is less convenient than with synchronous updating.
S Synchronous updating. In this mode, the called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. However, the called transaction is able to return any update error message that occurs to your program. It is much easier for you to analyze and recover from errors.
L Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program. (See the ABAP keyword documentation on SET UPDATE TASK LOCAL for more information.)
Regards -
Is pk recommended for update speed and update/insert v merge performance
Hi there,
We are looking to merge 50,000 rows or so into a table each day.
What is generally faster merge or 2 separate sqls (1 to insetrt and 1 to update). Like the merge command but wonder about performance vs the 2 sqls.
Also with both merge and update is it quicker to try match on a pk or would matching on other unique indexes be just as quick.
Many ThanksHi,
What is generally faster merge or 2 separate sqls (1 to insetrt and 1 to update)I would say, if you can do it on one operation, do it. But it should be easy for you to try it out.
Also with both merge and update is it quicker to try match on a pk or would matching on other unique indexes be just as quickYou aren't really matching on pk, since this is just a constraint. However, all PK constrains are backed by a unique index, so it should be the same.
But again, try it out
Regards
Peter -
Differences between APO and R3 sysytem.
Hi everybody,
Can anyone list out the differences between the APO system and the R3 system.A detailed explanation will be helpful.Hi,
APO
APO is the supply chain tool from SAP.
BW is the data layer for APO.
SAP APO is for Demand Planning and is a component of mySAP SCM. It enables dynamic supply chain management and which in turn includes applications for detailed planning, optimization and scheduling, allowing the supply chain to be accurately and globally monitored even beyond enterprise boundaries.
SAP BI is a reporting tool in SAP. It provides a complete view of the company. The solution is part of SAP NetWeaver and provides the tools needed to make the right decisions, optimize processes, and measure strategic success: data from all enterprise sources are merged effectively and can be comprehensively analyzed, business-critical factors can be monitored using external and internal benchmarks, the most important KPIs can be passed on to all the relevant forces in a company in real time, strategies can be rapidly adapted to changed market conditions, and the results of analyses can be graphically represented in a wide variety of formats, such as grids, graphs, and maps
Check this:
What is APO and how it is related to BW
SAP Advanced Planner and Optimizer is a component of the mySAP Supply Chain Management solution that you use for planning and optimizing supply chain processes at a strategic, tactical, and operational planning level.
With APO - Simultaneous Material & Capacity Planning is possible, as against R/3 PP
APO Planning is capable of taking all the constraints into consideration with Planning for Capacities/Scheduling
APO Resource (workcenter in R/3) does a Capacity availability check before scheduling an activity, if capacity is not available, it finds the immediate next available slot & schedules the activity there. This is not possible with R/3
http://www.sap.com/solutions/business-suite/scm/pdf/BWP_APO40.pdf
http://help.sap.com/saphelp_apo/helpdata/en/7e/63fc37004d0a1ee10000009b38f8cf/frameset.htm
http://help.sap.com/bp_biv133/documentation/BW/I18_Scen_InstallGuide_EN_DE.doc
http://help.sap.com/saphelp_scm41/helpdata/en/92/dd013872af2946e10000009b38f8cf/content.htm
http://help.sap.com/saphelp_apo/helpdata/en/7e/63fc37004d0a1ee10000009b38f8cf/frameset.htm
R/3 OLTP
Online Transactional data processing.
Designed to efficiently process high volumes of transactions, instantly recording business events (such as a sales invoice payment) and reflecting changes as they occur.
Current data
Short database transactions
Online update/insert/delete
Normalization is promoted
High volume transactions
Transaction recovery is necessary
http://en.wikipedia.org/wiki/OLTP
Refer for OLTP Vs OLAP
compare to r/3, what are the benefits available for b/w
R/3 and BW reports
http://www.geekinterview.com/question_details/209
http://blogs.netindonesia.net/kiki/archive/2006/02/28/8822.aspx
What's the Difference Between OLAP and OLTP?
Thanks,
JituK
Maybe you are looking for
-
Why wont my VEVO connect anymore
I've been watching Vevo on me TV for months now and I'm hooked. Now, When I try to watch VEVO a screen comes up and tells me I must be logged in my Vevo account 1. Go to vevo.com/apple. 2. When prompted enter the Activation Code below. I can't fin
-
Problem with running the app outside NetBeans (loading fxml from jar)
Hello. this problem occurs only when NOT using NetBeans (becouse NB may use this normal file sctructure, without jars) here is part of my main class, start method //load FXMLs FXMLLoader primaryLoader = new FXMLLoader(); URL p
-
Address bar too long, some addon icons are not revealed.
When addons are many, they aggregate to a small menu. This is very inconvenient. See pictures between firefox 30 and firefox 37 I tried to upload a image. In case I failed, see http://img.vim-cn.com/0b/310455fba225df5c97986cf270e6884a1fcde2.jpg
-
Silverlight Using 160% CPU
I have a 2009 13" MBP 2.26GHz 2 core 8 GB Ram 750 GB 7200 RPM Seagate Momentus XT Hybrid Drive. After a Driver for a Canon Camera started giving me errors, and using a lot of processor. I deleted it. It solved the problem for a little while. the i s
-
OC4J support Ajax based Application, If yes....give me example
Hi, I did Ajax based application and getting output in MyEclipse with Tomcat server. but, same Ajax Program I am running in oracle jdeveloper with OC4J, it's not getting output...... can anyone help.....what is the reason..... regards, Abu