Topics Topics Help/Instructions Help Edit Profile Profile Member List Register Paatha Gnyapakaalu - Archives from Old DB  
Search New Posts 1 | 2 | 8 Hours Search New Posts 1 | 3 | 7 Days Search Search Tree View Tree View Latest tweets Live Tweets   Hide Images
Bewarse Talk Discussion Board * Archives - 2015 * Cine Talk - Reviews, Gossips, Insider Info etc. * Archive through October 18, 2015 * DB Query < Previous Next >

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this 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:    Edit Post Delete Post Print Post


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 CLIPART--friday
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Krishna_jilla:




yea..emaindi thanninda ?MOVIEART--idea
A Famous Quote starts with a... and ends with this.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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?
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Dobbey:

chicago lo ne unnava..




avv.
A Famous Quote starts with a... and ends with this.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Stewie:

endi ee majjalo nallapos ayyipoyav..work pressure aa



chicago lo ne unnava..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Dobbey:




endi ee majjalo nallapos ayyipoyav..work pressure aa
A Famous Quote starts with a... and ends with this.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Stewie:


MOVIEART--chalayyachaluMOVIEART--blessme
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

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.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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;
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Proofdada:



MOVIEART--bemmi.sarle
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Mrbezawada:


annai nen vaadide okkate database..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

pl sql ani eedhoo vuntadhi ga orcle types lo db2 lo kooda... dhantloo rasthe visy ga vachudhi...
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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;
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Krishna_jilla:


eeyy pd gad sql exfertemi kadhu... D'y gadosthe raasi nokuthadu 2 secs la... aadu exfert...
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

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.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Blazewada:


WORK avvaledu bro....

Proofdada:



nite nundi kotkntna nakokkadke raadu ankna nato paatu miru kuda unnaru ani peace ga undhi.. MOVIEART--bemmi.laugh
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Blazewada:


merge kaadu annai if exists ani edo untadi
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Krishna_jilla:

ATTA chesanu ala two times db ni query cheste costly avtadi anta.


yeah true... perf Ds avudhi...
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

ayina nuvvu rasedhi java lo kadha... program lo mixi kotti if else lo sql stmt lu run sesuko ehee... no conpusion...MOVIEART--die
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Krishna_jilla:

uuid lekpothe complete ga kothadi row insert cheyali..


vaake idhi ignore kotta...
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

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...CLIPART--5run
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Blazewada:

merge command try chestunna which works on same table


vaakey annai..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Stewie:

Ayana ID unte update avvali Leda insert avvali antunnada.


MOVIEART--venky.ya
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Krishna_jilla:




merge command try chestunna which works on same table
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Proofdada:




Ayana ID unte update avvali Leda insert avvali antunnada.. Okka update statement iste artham enti MOVIEART--bemmi.lungi
A Famous Quote starts with a... and ends with this.
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


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..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Krishna_jilla:


oka table thoone rasukovachu ga?
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post


Proofdada:


Mari adhe na deggara undhi okate table.. rendu levu..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

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...
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

vetini upsert statements antaru anta.. google sesthunte dorkatledu sarigga..
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

Update with select ani google cheyyi syntax dorukuddhi
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

Update stmt lo id daggara aa select query pettatame
Syntax choosukoo
Top of pagePrevious messageNext messageBottom of page Link to this message

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:    Edit Post Delete Post Print Post

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..

Topics | Last Hour | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration