Author |
Message |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 2009 Registered: 04-2015 Posted From: 50.90.75.244
| Posted on Saturday, October 17, 2015 - 11:12 am: |
|
Krishna_jilla:MERGE INTO ERR_HOSP D USING SYSIBM.SYSDUMMY1 ON (D.UUID = '123') WHEN MATCHED THEN UPDATE SET D.RETRY_CNT = 1, ERR_TYP_CD = 'RESENT' WHEN NOT MATCHED THEN INSERT (UUID, RETRY_CNT, ERR_TYP_CD) VALUES ('123', 1, 'RESENT');
idhi work ayyindhi.. stewie ji.. thanksssuuu |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1983 Registered: 04-2015 Posted From: 143.115.155.58
| Posted on Thursday, October 15, 2015 - 1:58 pm: |
|
Stewie:yea..emaindi thanninda ?
ya 13:27:33 [MERGE - 0 row(s), 0.000 secs] [Error Code: -104, SQL State: 42601] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=WHERE;_TYP_CD = 'RESENT' ;LEFT_BRACKET, DRIVER=3.58.82 |
Stewie
Kurra Bewarse Username: Stewie
Post Number: 3489 Registered: 03-2011 Posted From: 66.151.13.188
| Posted on Thursday, October 15, 2015 - 1:50 pm: |
|
Krishna_jilla:
yea..emaindi thanninda ? A Famous Quote starts with a... and ends with this.
|
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1982 Registered: 04-2015 Posted From: 143.115.155.58
| Posted on Thursday, October 15, 2015 - 1:27 pm: |
|
Stewie:Db2 naa.. dual undademo meeku SYSIBM.SYSDUMMY1 try cheyyi
MERGE INTO ERR_HOSP D USING SYSIBM.SYSDUMMY1 ON (D.UUID = '123') WHEN MATCHED THEN UPDATE SET D.RETRY_CNT = 1, ERR_TYP_CD = 'RESENT' WHERE (D.UUID = '123') WHEN NOT MATCHED THEN INSERT (D.UUID, D.RETRY_CNT, D.ERR_TYP_CD) VALUES ('123', 1, 'RESENT'); ilana bro? |
Stewie
Kurra Bewarse Username: Stewie
Post Number: 3488 Registered: 03-2011 Posted From: 66.151.13.188
| Posted on Thursday, October 15, 2015 - 1:22 pm: |
|
Krishna_jilla:SQLERRMC=CI_DIAL.DUAL
Db2 naa.. dual undademo meeku SYSIBM.SYSDUMMY1 try cheyyi A Famous Quote starts with a... and ends with this.
|
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1981 Registered: 04-2015 Posted From: 143.115.155.58
| Posted on Thursday, October 15, 2015 - 1:14 pm: |
|
Stewie:
13:14:16 [MERGE - 0 row(s), 0.000 secs] [Error Code: -204, SQL State: 42704] DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=CI_DIAL.DUAL, DRIVER=3.58.82 e error ochndi ji.. |
Stewie
Kurra Bewarse Username: Stewie
Post Number: 3487 Registered: 03-2011 Posted From: 66.151.13.188
| Posted on Thursday, October 15, 2015 - 12:46 pm: |
|
Dobbey:chicago lo ne unnava..
avv. A Famous Quote starts with a... and ends with this.
|
Dobbey
Mudiripoyina Bewarse Username: Dobbey
Post Number: 22048 Registered: 12-2009 Posted From: 98.214.79.168
| Posted on Thursday, October 15, 2015 - 12:41 pm: |
|
Stewie:endi ee majjalo nallapos ayyipoyav..work pressure aa
chicago lo ne unnava..
|
Stewie
Kurra Bewarse Username: Stewie
Post Number: 3486 Registered: 03-2011 Posted From: 66.151.13.188
| Posted on Thursday, October 15, 2015 - 12:39 pm: |
|
Dobbey:
endi ee majjalo nallapos ayyipoyav..work pressure aa A Famous Quote starts with a... and ends with this.
|
Dobbey
Mudiripoyina Bewarse Username: Dobbey
Post Number: 22047 Registered: 12-2009 Posted From: 98.214.79.168
| Posted on Thursday, October 15, 2015 - 12:31 pm: |
|
Stewie:
|
Stewie
Kurra Bewarse Username: Stewie
Post Number: 3484 Registered: 03-2011 Posted From: 50.148.66.251
| Posted on Thursday, October 15, 2015 - 11:03 am: |
|
MERGE INTO ERR_HOSP D USING DUAL ON (D.UUID = '123') WHEN MATCHED THEN UPDATE SET D.RETRY_CNT = 1, ERR_TYP_CD = 'RESENT' WHERE (D.UUID = '123') WHEN NOT MATCHED THEN INSERT (D.UUID, D.RETRY_CNT, D.ERR_TYP_CD) VALUES ('123', 1, 'RESENT'); ila emanna try cheyyali.. A Famous Quote starts with a... and ends with this.
|
Mrbezawada
Pilla Bewarse Username: Mrbezawada
Post Number: 101 Registered: 10-2011 Posted From: 205.172.134.23
| Posted on Thursday, October 15, 2015 - 10:58 am: |
|
Krishna_jilla:
DROP TABLE #Source CREATE TABLE #Source ( id INT IDENTITY , Flag NVARCHAR(10) ) INSERT INTO #Source VALUES ('Inserted'); INSERT INTO #Source VALUES ('Inserted'); INSERT INTO #Source VALUES ('Inserted'); SELECT * FROM #Source DECLARE @id INT SET @id = 3; IF EXISTS ( SELECT * FROM #Source WHERE id = @id ) UPDATE #Source SET Flag = 'Updated' WHERE id = @id ELSE INSERT INTO #Source VALUES ('Inserted') SELECT * FROM #Source Bezawada Bewarse Batchey
|
Blazewada
Mudiripoyina Bewarse Username: Blazewada
Post Number: 24708 Registered: 08-2008 Posted From: 183.90.116.212
| Posted on Thursday, October 15, 2015 - 10:47 am: |
|
Krishna_jilla:
CREATE PROCEDURE libname.UPSERT_MYTABLE ( IN THEKEY DECIMAL(9,0), IN NEWVALUE CHAR(10) ) LANGUAGE SQL MODIFIES SQL DATA BEGIN DECLARE FOUND CHAR(1); -- Set FOUND to 'Y' if the key is found, 'N' if not. -- (Perhaps there's a more direct way to do it.) SET FOUND = 'N'; SELECT 'Y' INTO FOUND FROM SYSIBM.SYSDUMMY1 WHERE EXISTS (SELECT * FROM MYTABLE WHERE KEY = THEKEY); IF FOUND = 'Y' THEN UPDATE MYTABLE SET VALUE = NEWVALUE WHERE KEY = THEKEY; ELSE INSERT INTO MYTABLE (KEY, VALUE) VALUES (THEKEY, NEWVALUE); END IF; END; |
Maveric
Yavvanam Kaatesina Bewarse Username: Maveric
Post Number: 6056 Registered: 01-2012 Posted From: 103.16.70.13
| Posted on Thursday, October 15, 2015 - 10:42 am: |
|
Proofdada:
|
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1979 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:41 am: |
|
Mrbezawada:
annai nen vaadide okkate database.. |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143899 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:40 am: |
|
pl sql ani eedhoo vuntadhi ga orcle types lo db2 lo kooda... dhantloo rasthe visy ga vachudhi... |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1978 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:38 am: |
|
Stewie:
IF(EXISTS(SELECT * FROM ERR_HOSP WHERE UUID = '123'))THEN UPDATE ERR_HOSP SET RETRY_CNT =1 ,ERR_TYP_CD = 'RESENT' WHERE UUID ='123'; END IF; |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143897 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:37 am: |
|
Krishna_jilla:
eeyy pd gad sql exfertemi kadhu... D'y gadosthe raasi nokuthadu 2 secs la... aadu exfert... |
Stewie
Kurra Bewarse Username: Stewie
Post Number: 3483 Registered: 03-2011 Posted From: 50.148.66.251
| Posted on Thursday, October 15, 2015 - 10:37 am: |
|
merge into mergetest m using dual on (a = xa) when not matched then insert (a,b) values (xa,1) when matched then update set b = b+1; Krishna_jilla:WORK avvaledu bro....
merge ye vaddali.. assalu nuvvu em rasavo ikkada ettu.. A Famous Quote starts with a... and ends with this.
|
Mrbezawada
Pilla Bewarse Username: Mrbezawada
Post Number: 100 Registered: 10-2011 Posted From: 205.172.134.23
| Posted on Thursday, October 15, 2015 - 10:36 am: |
|
KJ, Check this DROP TABLE #Source DROP TABLE #Destination CREATE TABLE #Source ( id INT , name NVARCHAR(10) , salary FLOAT ) INSERT INTO #Source VALUES (1,'Siva',10.00); INSERT INTO #Source VALUES (2,'Rama',20.00); INSERT INTO #Source VALUES (3,'Krish',30.00); CREATE TABLE #Destination ( id INT , name NVARCHAR(10) , salary FLOAT ) INSERT INTO #Destination SELECT * FROM #Source SELECT * FROM #Source SELECT * FROM #Destination INSERT INTO #Source VALUES ( 4, 'Brahmi' , 40.00) UPDATE #Source SET name = 'Rams' WHERE id = 2 SELECT * FROM #Source SELECT * FROM #Destination INSERT INTO #Destination SELECT S.* FROM #Source S LEFT JOIN #Destination D ON S.id = D.id WHERE D.id IS NULL UPDATE D SET d.name = s.name , d.salary = s.salary FROM #Source S LEFT JOIN #Destination D ON S.id = D.id WHERE d.name <> s.name OR d.salary <> s.salary SELECT * FROM #Source SELECT * FROM #Destination Bezawada Bewarse Batchey
|
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1977 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:33 am: |
|
Blazewada:
WORK avvaledu bro....
Proofdada:
nite nundi kotkntna nakokkadke raadu ankna nato paatu miru kuda unnaru ani peace ga undhi.. |
Blazewada
Mudiripoyina Bewarse Username: Blazewada
Post Number: 24705 Registered: 08-2008 Posted From: 183.90.116.212
| Posted on Thursday, October 15, 2015 - 10:26 am: |
|
Krishna_jilla:
Begin atomic if( exists( SELECT ID FROM EMPLOYEE WHERE ID='UUID' ) ) then UPDATE EMPLOYEE SET NAME='krishnajilla' end if; else insert into employee ........ End |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1974 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:23 am: |
|
Blazewada:
merge kaadu annai if exists ani edo untadi |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143893 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:21 am: |
|
Krishna_jilla:ATTA chesanu ala two times db ni query cheste costly avtadi anta.
yeah true... perf Ds avudhi... |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1973 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:20 am: |
|
Proofdada:ayina nuvvu rasedhi java lo kadha... program lo mixi kotti if else lo sql stmt lu run sesuko ehee... no conpusion...
ATTA chesanu ala two times db ni query cheste costly avtadi anta.. so okkasare cheyamani ancheppadu. danki upsert statement use cheyamanadu.. |
Blazewada
Mudiripoyina Bewarse Username: Blazewada
Post Number: 24704 Registered: 08-2008 Posted From: 183.90.116.212
| Posted on Thursday, October 15, 2015 - 10:16 am: |
|
Proofdada:
Krishna_jilla:
MERGE TableX A using (SELECT ID as 'UUID' FROM DUAL) AS B ON A.ID = B.ID WHEN MATCHED THEN UPDATE SET A.FirstName = 'xx', A.LastName = 'yy' WHEN NOT MATCHED THEN INSERT VALUES (B.ID, 'xx', 'yy'); tittoddu ed try chesaa. |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143892 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:15 am: |
|
ayina nuvvu rasedhi java lo kadha... program lo mixi kotti if else lo sql stmt lu run sesuko ehee... no conpusion... |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143891 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:14 am: |
|
Krishna_jilla:uuid lekpothe complete ga kothadi row insert cheyali..
vaake idhi ignore kotta... |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143890 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:12 am: |
|
UPDATE t1 SET t1.col2 = 10 * (t2.col1 + t2.col2) FROM theTable t1 INNER JOIN theTable t2 ON t1.busRelAccount = t2.busRelAccount WHERE t1.rowName = 'INVENTORY' AND t2.rowName = 'POS' ; ata... |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1972 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:11 am: |
|
Blazewada:merge command try chestunna which works on same table
vaakey annai.. |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1971 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:10 am: |
|
Stewie:Ayana ID unte update avvali Leda insert avvali antunnada.
|
Blazewada
Mudiripoyina Bewarse Username: Blazewada
Post Number: 24702 Registered: 08-2008 Posted From: 183.90.116.212
| Posted on Thursday, October 15, 2015 - 10:10 am: |
|
Krishna_jilla:
merge command try chestunna which works on same table |
Stewie
Kurra Bewarse Username: Stewie
Post Number: 3482 Registered: 03-2011 Posted From: 50.148.66.251
| Posted on Thursday, October 15, 2015 - 10:09 am: |
|
Proofdada:
Ayana ID unte update avvali Leda insert avvali antunnada.. Okka update statement iste artham enti A Famous Quote starts with a... and ends with this.
|
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1970 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:09 am: |
|
Proofdada:oka table thoone rasukovachu ga?
Nik question ardamayyinda annai.. oka table lo uuid already unte just konni fields update cheyali uuid lekpothe complete ga kothadi row insert cheyali.. |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143889 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:04 am: |
|
Krishna_jilla:
oka table thoone rasukovachu ga? |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1969 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 10:02 am: |
|
Proofdada:
Mari adhe na deggara undhi okate table.. rendu levu.. |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143888 Registered: 03-2004 Posted From: 71.170.93.71
| Posted on Thursday, October 15, 2015 - 10:00 am: |
|
Indiana vachi thanthe mylavaram lo padathav UPDATE table1 SET column1 = (SELECT expression1 FROM table2 WHERE conditions) WHERE conditions; nee moham meedha nee boyfriend srikanth gad retteyya... |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1968 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 9:55 am: |
|
vetini upsert statements antaru anta.. google sesthunte dorkatledu sarigga.. |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143887 Registered: 03-2004 Posted From: 166.137.126.23
| Posted on Thursday, October 15, 2015 - 9:50 am: |
|
Update with select ani google cheyyi syntax dorukuddhi |
Proofdada
Bewarse Legend Username: Proofdada
Post Number: 143886 Registered: 03-2004 Posted From: 166.137.126.23
| Posted on Thursday, October 15, 2015 - 9:49 am: |
|
Update stmt lo id daggara aa select query pettatame Syntax choosukoo |
Krishna_jilla
Kurra Bewarse Username: Krishna_jilla
Post Number: 1967 Registered: 04-2015 Posted From: 143.115.159.58
| Posted on Thursday, October 15, 2015 - 9:47 am: |
|
Db2 query okkati kavali like rendu cheyali select * from table where UUID = ? if it matches then update certain columns of that id or else insert it as a new id. any help plss.. |