How to update and insert automatically
Hi all,
I am having two tables, old and new (first column is PKey in two tables)
NEW
5 col2 col3 col4
6 col2 col3 col4
1 col2 col3 col44
2 col2 col3 col4
3 col2 col33 col4
4 col2 col3 col4
OLD
1 col2 col3 col4
2 col2 col3 col4
3 col2 col3 col4
4 col2 col3 col4
I want to update/insert in OLD table from the NEW tables values.
I think i will use MERGE statement, but sometimes, the column value will
change (PKey didnot change), so MERGE wont work here.
With MINUS statement, i will get the differences
select COL1, COL2, COL3, COL4
from NEW
minus
select COL1, COL2, COL3, COL4
from OLD;
1 col2 col3 col44
3 col2 col33 col4
5 col2 col3 col4
6 col2 col3 col4
I want to update/insert these values Remotely in OLD (OLD table actually in Remote). I cannot send all the data of NEW table to remote because the data is very large. So, i have to take the differences and i have to send those differences to Remote and i have to update/insert remotely.
Any help is appreciated.
Thanks in advance
Pal
try like this:
merge
into old t
using (
select COL1, COL2, COL3, COL4
from NEW
minus
select COL1, COL2, COL3, COL4
from OLD
) v
on (v.col1 = t.col1)
when matched
then update set t.col2 = v.col2, t.col3 = v.col3, t.col4 = v.col4
when not matched
then insert(col1, col2, col3, col4) values(v.col1, v.col2, v.col3, v.col4)
Similar Messages
-
How to update and insert the records without using Table_comparison and Map_operation?
Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE
-
How can we do policy updations and insertion using procedures in insurence?
how can we do policy updations and insertion using procedures in insurence?
please answer for this post i need faced in interview.how can we write the code for that procedure in policy details using procedures in plsql.997995 wrote:
how can we do policy updations and insertion using procedures in insurence?
please answer for this post i need faced in interview.how can we write the code for that procedure in policy details using procedures in plsql.You are asking about a specific business area (Insurance) and the nuances of that business (Insurance Policies) and providing no technical details about what is required, on a technical forum. There are many varied businesses in the world and not everyone here is going to be familiar with the area of business you are referring to.
As a technical forum, people are here to assist with technical issues, not to try and help you answer questions in an interview for something you clearly know nothing about, so that you can get a job that you won't know how to do.
If you have a specific technical issue, post appropriate details, including database version, table structures and indexes, example data and expected output etc. as detailed in the FAQ: {message:id=9360002} -
How to update transaction data automatically into MySQL database using PI
Dear All,
With reference to subject matter I want a sincere advice regarding how to update transaction data automatically into MySQL database using PI. Is there any link available where I can get step-by-step process.
Ex: I have a MYSQL database in my organization. Whenever a delivery created in SAP some fields like DO Number, DO quantity, SO/STO number should get updated in MYSQL database automatically.
This scenario is related to updation of transactional data into MYSQL DB and I want your suggestions pertaining to same issue.
Thanks and Regards,
Chandra SekharHi .
Develop a sceanrio between SAP to Database system,When the data updates in SAP Tables read the data and update it in DATA Base using JDBC adapter,but there will be some delay in updating data in MySQL.
serach in sdn for IDOC-TOJDBC sceannario,many documents available for the same.
Regards,
Raja Sekhar -
Hi All,
I am uploading data from a txt file into itab_infile and wants to update the table Zppprice based on itab_infile. It the record is existing it has to update and when it is a new record it has to insert the record. And I need to capture how many records havebeen updated and inserted.
Please help me.
Thanks,
Veni.
REPORT ZSD_PRICEPROTEC NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 60.
TABLES: KNA1,ZPPPRICE.
TYPES: BEGIN OF type_infile,
KUNNR(10) TYPE c, "Customer Number
MATNR(18) TYPE c, "Material Number
CRDATE(10) TYPE c, "Creation Date
EFDATE(10) TYPE c, "Effective date
SPRICE(15) TYPE c, "Old Price
EPRICE(15) TYPE c, "New Price
EOHQTY(09) TYPE c, "Estimated Quantity
AOHQTY(09) TYPE c. "Actual Quantity
TYPES: END OF type_infile.
* Internal tables
DATA: itab_infile TYPE STANDARD TABLE OF type_infile with header line.
* Work areas
DATA: wa_infile TYPE type_infile.
* Global variables.
DATA: gc_tcode LIKE sy-tcode VALUE 'VA01'. "Transaction code
SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK one.
START-OF-SELECTION.
PERFORM upload_text_file.
*& Form UPLOAD_TEXT_FILE
FORM upload_text_file.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = itab_infile
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'Error in loading text file'.
ENDIF.
ENDFORM. " UPLOAD_TEXT_FILEHi Veni,
Simple thing ,you can use MODIFY Command,it works both insert as well update.
check the documentation.
see the below program and i am getting data from XLS file and i am updating to Ztable( same as ur case ).
Program : ZLWMI151_UPLOAD(Data load to ZBATCH_CROSS_REF Table)
Type : Upload program
Author : Seshu Maramreddy
Date : 05/16/2005
Transport : DV3K919574
Transaction: None
Description: This program will get the data from XLS File
and it upload to ZBATCH_CROSS_REF Table
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data
Thanks
Seshu -
Rows updated and inserted by MERGE
Hi,
Is there any way I can come to know, How many rows are updated and inserted using a MERGE statement.
Thanks in advanceSomething like this ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.01
satyaki>
satyaki>
satyaki>
satyaki>desc aud_emp;
Name Null? Type
EMPNO NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
AUDIT_TMP TIMESTAMP(6)
AUDIT_IP_ADDR VARCHAR2(15)
OPR_DESC VARCHAR2(30)
USER_NM VARCHAR2(40)
REMARKS VARCHAR2(200)
satyaki>
satyaki>
satyaki>
satyaki>
satyaki>select * from aud_emp;
no rows selected
Elapsed: 00:00:00.04
satyaki>
satyaki>
satyaki>select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10
7777 SOURAV SLS 14-SEP-08 45000 3400 10
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 4450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 7000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
13 rows selected.
Elapsed: 00:00:00.01
satyaki>
satyaki>select * from e_emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 3718.75 20
7782 CLARK MANAGER 7839 09-JUN-81 3062.5 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 11700 10
7 rows selected.
Elapsed: 00:00:00.07
satyaki>CREATE OR REPLACE TRIGGER trg_aud
before insert or update or delete on e_emp
for each row
declare
S_IP_ADDR varchar2(30);
str varchar2(320);
s_empno varchar2(40);
s_ename varchar2(40);
s_job varchar2(40);
s_mgr varchar2(40);
s_hrdate varchar2(40);
s_sal varchar2(40);
s_comm varchar2(40);
s_deptno varchar2(40);
begin
SELECT SYS_CONTEXT('USERENV','IP_ADDRESS')
into S_IP_ADDR
from dual;
str:= null;
if inserting then
insert into aud_emp values(:new.empno,
:new.ename,
:new.job,
:new.mgr,
:new.hiredate,
:new.sal,
:new.comm,
:new.deptno,
systimestamp,
S_IP_ADDR,
'INSERT',
USER,
NULL);
elsif updating then
if :old.empno <> :new.empno then
s_empno := 'Employee No: '||:old.empno;
elsif :old.ename <> :new.ename then
s_ename := 'Employee Name: '||:old.ename;
elsif :old.job <> :new.job then
s_job := 'Job: '||:old.job;
elsif :old.mgr <> :new.mgr then
s_mgr := 'Mgr: '||:old.mgr;
elsif :old.hiredate <> :new.hiredate then
s_hrdate := 'Hire Date: '||:old.hiredate;
elsif :old.sal <> :new.sal then
s_sal := 'Salary: '||:old.sal;
elsif :old.comm <> :new.comm then
s_comm := 'Commission: '||:old.comm;
elsif :old.deptno <> :new.deptno then
s_deptno := 'Department No: '||:old.deptno;
end if;
str:= 'Updated Records Details -> '||s_empno||' '||s_ename||' '||s_job||' '||s_mgr||' '||s_hrdate||' '||s_sal||' '||s_comm||' '||s_deptno;
insert into aud_emp values(:new.empno,
:new.ename,
:new.job,
:new.mgr,
:new.hiredate,
:new.sal,
:new.comm,
:new.deptno,
systimestamp,
S_IP_ADDR,
'UPDATE',
USER,
str);
elsif deleting then
insert into aud_emp values(:old.empno,
:old.ename,
:old.job,
:old.mgr,
:old.hiredate,
:old.sal,
:old.comm,
:old.deptno,
systimestamp,
S_IP_ADDR,
'DELETE',
USER,
'Old Records before deletion');
end if;
exception
when others then
raise_application_error(-20501,'Contact With Your Admin....');
end;
Trigger Created.
Elapsed: 00:00:00.09
satyaki>ed
Wrote file afiedt.buf
1 merge into e_emp o
2 using emp n
3 on ( o.empno = n.empno)
4 when matched then
5 update set o.ename = n.ename,
6 o.job = n.job,
7 o.mgr = n.mgr,
8 o.hiredate = n.hiredate,
9 o.sal = n.sal,
10 o.comm = n.comm,
11 o.deptno = n.deptno
12 when not matched then
13 insert( o.empno,
14 o.ename,
15 o.job,
16 o.mgr,
17 o.hiredate,
18 o.sal,
19 o.comm,
20 o.deptno)
21 values( n.empno,
22 n.ename,
23 n.job,
24 n.mgr,
25 n.hiredate,
26 n.sal,
27 n.comm,
28* n.deptno)
satyaki>/
13 rows merged.
Elapsed: 00:00:03.95
satyaki>
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.07
satyaki>
satyaki>
satyaki>select * from aud_emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO AUDIT_TMP AUDIT_IP_ADDR OPR_DESC USER_NM REMARKS
7566 JONES MANAGER 7839 02-APR-81 2975 20 31-DEC-08 10.54.06.667000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details -> Salary: 3718.75
7782 CLARK MANAGER 7839 09-JUN-81 4450 10 31-DEC-08 10.54.06.686000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details -> Salary: 3062.5
7788 SCOTT ANALYST 7566 19-APR-87 3000 20 31-DEC-08 10.54.06.687000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details ->
7839 KING PRESIDENT 17-NOV-81 7000 10 31-DEC-08 10.54.06.697000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details -> Salary: 5000
7876 ADAMS CLERK 7788 23-MAY-87 1100 20 31-DEC-08 10.54.06.698000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details ->
7902 FORD ANALYST 7566 03-DEC-81 3000 20 31-DEC-08 10.54.06.699000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details ->
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 31-DEC-08 10.54.06.720000 PM 10.23.99.77 INSERT SCOTT
7777 SOURAV SLS 14-SEP-08 45000 3400 10 31-DEC-08 10.54.07.059000 PM 10.23.99.77 INSERT SCOTT
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 31-DEC-08 10.54.07.060000 PM 10.23.99.77 INSERT SCOTT
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 31-DEC-08 10.54.07.060000 PM 10.23.99.77 INSERT SCOTT
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 31-DEC-08 10.54.07.061000 PM 10.23.99.77 INSERT SCOTT
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO AUDIT_TMP AUDIT_IP_ADDR OPR_DESC USER_NM REMARKS
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10 31-DEC-08 10.54.07.061000 PM 10.23.99.77 INSERT SCOTT
7900 JAMES CLERK 7698 03-DEC-81 950 30 31-DEC-08 10.54.07.062000 PM 10.23.99.77 INSERT SCOTT
13 rows selected.
Elapsed: 00:00:00.22
satyaki>
satyaki>set lin 80Hope this will help you.
Regards.
Satyaki De. -
Mutilple updations and insertions by BAPI_SALESORDER_CHANGE at one time
Hi ,
I just want to know whether it is possible to insert and update multiple line items in a sales order through the BAPI BAPI_SALESORDER_CHANGE .
we tried doin it for single record ( update and insert ) , it is working fine . but when we try for mutiple items , it gives a system dump.
could you plz help out , how to pass the parameters for mutiple updation and insertions at a time?HI ALL,
I THINK IF WE MAKE THE SCHEDULE LINE ITEM NO. TO BE UNIQUE FOR EACH LINE ITEM IT GETS UPLOADED PROPERLY. THE VBEP-ETENR IS 001 ONLY. PEOPLE WITH ALTERNAT ANSWERS PLZ. CORRECT.
SEE CODES BELOW.
**This creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '2'.
APPEND T_ITEM.
T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '1'.
T_SCHE-REQ_QTY = 2.
t_sche-req_date = '20080204'.
APPEND T_SCHE.
T_SCHEX-updateflag = c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-SCHED_LINE = '1'.
t_schex-req_qty = 'X'.
APPEND T_SCHEX.
**This also creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
*T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '1'.
APPEND T_ITEM.
*T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '4'.
t_sche-req_date = '20080202'.
T_SCHE-REQ_QTY = 1.
APPEND T_SCHE.
T_SCHEX-updateflag = c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-ITM_NUMBER = 'X'.
T_SCHEX-SCHED_LINE = '4'.
T_SCHEX-REQ_QTY = 'X'.
APPEND T_SCHEX.
**This also creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
*T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '1'.
APPEND T_ITEM.
*T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '5'.
t_sche-req_date = '20080202'.
T_SCHE-REQ_QTY = 1.
APPEND T_SCHE.
T_SCHEX-updateflag = c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-ITM_NUMBER = 'X'.
T_SCHEX-SCHED_LINE = '5'.
T_SCHEX-REQ_QTY = 'X'.
APPEND T_SCHEX.
**This also creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
*T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '1'.
APPEND T_ITEM.
*T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '6'.
t_sche-req_date = '20080202'.
T_SCHE-REQ_QTY = 1.
APPEND T_SCHE.
T_SCHEX-updateflag = c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-ITM_NUMBER = 'X'.
T_SCHEX-SCHED_LINE = '6'.
T_SCHEX-REQ_QTY = 'X'.
APPEND T_SCHEX.
*i_order_header_in-sd_doc_cat -
Possible to update and insert in a table at a same time
Hi friends,
I have a table with six columns in it.
Initially that table will have seven rows with six columns, but all the columns wont have a content in it. But only one column will have the content of seven rows. so that's why initially it will have seven rows.
Assume that first column consist of the following seven content each in a row(so seven row)
*)A
*)B
*)C
*)D
*)E
*)F
*)G
So what i need to do is set DML operation such that for the existing seven rows which is in the table i need to update the value of the remaining six column and at the same time i need to insert all the seven rows of only the first column in the next seven rows.
Whether it is possible to do it.
How to achieve it friends,
Thanks
Regards,
MiniHi,
It should be like
Initially my table would be like the below
*questions StronglyAgree DA AG suggestions*
what is ur name?
what is ur age?
which is ur pet? My DML operation should be like it should update and insert
Update in the sense, it should be like
*questions StronglyAgree DA AG suggestions*
what is ur name? y my name
what is ur age? y my age
which is ur pet? y my petSoon after that insert should be like
*questions StronglyAgree Disagree Agree suggestions*
what is ur name? y my name
what is ur age? y my age
which is ur pet? y my pet
what is ur name?
what is ur age?
which is ur pet?It should be like the above..
All izz well
GTA
Edited by: GTA on Jun 13, 2011 6:43 AM
Edited by: GTA on Jun 13, 2011 6:43 AM -
Use of the "updlock" hint with update and insert statements
I have inherited some stored procedures and am trying to figure out why the developers decided to use the "updlock" hint on many of the update and insert statements. I have looked around everywhere and have found only one explanation of why "update...with
(updlock)" can be useful, namely when a table has no clustered index:
http://www.sqlnotes.info/2012/10/10/update-with-updlock/ I have found nothing yet that mentions why "insert into...with (updlock)" might be used. I understand why the hint
might be useful on select statements in some cases, but if all of the tables have clustered indexes, is there any good reason to use it on update and insert statements?
Thanks,
Ron
Ron RiceThis form of deadlock error can occur on a table which has a clustered index.
If you are doing updates on a table which has a clustered index and that table also has a nonclustered index and the nonclustered index is used to find the row to update you can see this type of deadlock. For example create a table with a clustered
primary key index and a nonclustered index by running
Create Table Foo(PK int primary key identity, OtherKey varchar(10), OtherData int);
go
Insert Foo Default Values;
go 10000
Update Foo Set OtherKey = 'C' + Cast(PK As varchar(10))
Create Unique Index FooIdx On Foo(OtherKey);
That creates a table with 10000 rows, a clustered index and a nonclustered index. Then run
Begin Transaction
Update Foo Set OtherData = 1 Where OtherKey = 'C5'
That will use the FooIdx index to find the row that needs to be updated. It will get a U lock on the index row in the FooIdx index, then an X lock on the row in the clustered index, update that row, then free the U lock on FooIdx, but keep the X lock
on the row in the clustered index. (There is other locking going on, but to simplify things, I'm only showing the locks that lead to the deadlock).
Then in another window, run
Begin Transaction
Update Foo Set OtherData = 2 Where OtherKey = 'C5'
This will get a U lock on the index row in the FooIdx index, then try to get an X lock on the row in the clustered index. But that row is already exclusively locked, so this second window will wait holding a U lock on FooIdx row and is waiting for
an X lock on the clustered index row.
Now go back to the first window and run
Update Foo Set OtherData = 3 Where OtherKey = 'C5'
This will once again try to get the U lock on the FooIdx row, but it is blocked by the U lock the second window holds. Of course the second window is blocked by the X lock on the clustered index row and you have a deadlock.
All that said, I certainly do not routinely code my updates with UPDLOCK. I try to design databases and write code so that deadlocks will be rare without holding excessive locks. The more locks you hold and the longer you hold them, the more
blocking you will get and the slower your system will run. So I write code that if a deadlock exception occurs, it is properly handled. Then if too many deadlocks occur, that is the time to go back to the code to see what changes are needed to
decrease the number of deadlocks (one way to do that may be to get locks earlier and/or hold them longer.
But I wouldn't worry much about this form of deadlock. It is, in my experience, vary rare. I don't recall ever seeing it in a production environment.
Tom -
How to update and download new applications
hi there,
How to update and download application? It ask to accept terms and condition but not showing any "accept" button.Hello sachin1620,
Thank you for providing the details of the issue you are experiencing with accepting Terms & Conditions on your iPhone.
First, I recommend restarting your phone and then resetting if it's still not working:
Restarting your device
Press and hold the Sleep/Wake button for a few seconds until the red "slide to power off" slider appears, and then slide the slider.
Press and hold the Sleep/Wake button until the Apple logo appears.
Note: Reset your device only if you are unable to restart it.
Resetting your device
Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
You can find the full article here:
iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
http://support.apple.com/kb/ht1430
If you can access your home screen, I also recommend verifying that cookies are not blocked and private browsing is turned off in Settings>Safari:
iPhone User Guide - Safari settings
http://help.apple.com/iphone/7/#/iph3d7aa74dc
Thank you for using Apple Support Communities.
Best,
Sheila M. -
Do firmware updates come with Software Update and installed automatically?
Do firmware updates come with Software Update and installed automatically?
Do firmware updates come with Software Update
Yes.
and installed automatically?
No (at least, I can't think of one that has automatically run). Usually Software Update will download an updater that you then need to run separately. Usually the updaters will be installed to the Utilities folder ready for you to use. -
what is the difference between update and insert in the case of database tables? what does update do and what does insert do?
Hi,
Insert Functionality,
Inserts new lines in a database table.By default, data is only inserted in the current client. Data can only be inserted using a view if the view refers to a single table and was defined in the ABAP Dictionary with the maintenance status "No restriction".
Update Functionality,
Updates values in a database table. Normally, lines are updated only in the current client.
INSERT & UPDATE belongs to the Open SQL command set.
Thanks
Nimesh S. Patel -
How to update Purchase Request automatically when update qty in sales order
When we create a sales order, the PR will be automatically generated.
Now we have a requirement to change the order qty for the sales order. also the PR should be automatically changed.
With VA02, the process is perfect.
But by using BAPI_SALESORDER_CHANGE the SO is partly changed ( order qty is changed but the confirmed qty is not changed) and the PR is not changed.
So can you advise me how to update the PR by using the BAPI_SALESORDER_CHANGE, which indicator should be defined?
I've read the BAPI document but no such information.
Regards,Hi Yang,
Workflow is the best approach for any issue related to business objects.
Since you want call FM BAPI_SALESORDER_CHANGE, it will change SO. It means everytime any SO is changed there will an event being triggered.
object type: BUS2032
event: Changed
simple solution:
1. Please create object type (SWO1) and its super type should be BUS2032.
2. Add your own method and attach your custom FM which actually updates the qty & PR)
3. Create Task (PFTC_INS)
in basic data:
- provide object type which you have created
- provide method which you have added
goto triggering events tab
- Choose Object Category as BOR object type
- provide object type (better give BUS2032)
- provide event as CHANGED
Please have look into very nice video blog which helps you to create your workflow.
blog: [Creating your first SAP Business Workflow]
Regards,
Sukhbold Altanbat. -
Creation of a Single button for both Update and Insert
Hi,
I want to create a button which performs both Insert and Update function. As of now i have 2 seperate buttons. Can I combine them in to one by writing a procedure which checks for the data in the database...If the record exists, then it should update the record, if not it should insert...Please guide me
Regards,
PaHi,
If I am inserting in to the table a new record, how do I check for that column in the table...
It should work this way..
I have a list of users in a page, if I click on any user name, it will redirect me to another screen which will allow me to create a record for the selected user name. I want to check the selected user name in the table. If it is already existing then need to update, else insert.
Regards,
Pa -
How to update 2 fields automatically rest manually on page
Hello folks,
I have got a question on how to update 2 fields in a table automatically (in my case this is one field for the user and one field for the correct date and time). This should happen automatically every time an user changes a row in the table. But it seems as if i cant change the fields i tried it with the changing of the textfield but he dont change the values in the database. I even tried a separate update statement but since this is set after the commitchanges() command it seems as if he ignores any following commands.
So anybody a good idea how i can change easily these two data fields? I just cant believe that you must manually change the fields, thats not the use of these 2 fields.
Thanks in advance for your help
AcinonyxTo be exact i have got a page with different fields which get their data from my database. Two fields which contain an userid and the other a date and time value should get updated automatically when the user changes something of the other values on this page and press a button which calls the commitchange method. But since this should happen automatically and not manually i cant put these changes in the database. The manual changes are saved without any problems but the automatical changes not. So my question is how can i change a value programmatically and make him save these canges in the database?
I already tried to put the new values in the fields or even detailed in the database but i cant get him to update these two fields.
Acinonyx
Maybe you are looking for
-
Songs will play in iTunes but not play on iPod!
This is very weird. I have 44 songs that are not working right. A few months ago I moved my music files to one central location on my computer (aside from iTunes). I wanted to get rid of duplicates and songs I just didn't want and more importantly I
-
I ordered this PC a few days ago: 'HP Beats Special Edition 15-p099no' and received it today. I absolutely hate Windows 8, so I tried installing my lovely Windows 7. No luck. I pressed ESC when the computer was starting up, and then F9. Out of these
-
HT1430 Can't send mail ( can only receive mail)
How can I receive Mai ?
-
Notificati​ons not going away
Hello I have a Curve 8330 and I received two notifications on the very top of my screen that I needed to update some apps on my phone. I went into my BlackBerry app word and updated them, but the notification is still on my screen. The same thing is
-
Direct load insert vs direct path insert vs nologging
Hello. I am trying to load data from table A(only 4 columns) to table B. Table B is new. I have 25 million records in table A. I have debating between direct load insert,, direct path insert and nologging. What is the diference between the three meth