DB2 MERGE statement



IBM's flagship relational database management system

DB2 MERGE statement

Postby satyabrata » Sat Feb 09, 2019 2:01 pm

Hello All,

I tried the following MERGE SQL statement but i am getting the error. Please help me.

MERGE INTO MYTABLE2 M                              
       USING MYTABLE D                            
       ON (M.PID=D.PID)                            
 WHEN  MATCHED THEN                                
       UPDATE SET   M.SALES  = (M.SALES + D.SALES),
                    M.STATUS = D.STATUS            
       DELETE WHERE M.STATUS = 'OBS'              
 WHEN  NOT MATCHED THEN                            
       INSERT VALUES (D.PID,D.SALES,'NEW');      


Error:

DSNT408I SQLCODE = -104, ERROR:  ILLEGAL SYMBOL "MYTABLE". SOME SYMBOLS THAT
         MIGHT BE LEGAL ARE: (            
 

Regards
Satyabrata
satyabrata
 
Posts: 2
Joined: Fri Feb 08, 2019 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DB2 MERGE statement

 

Re: DB2 MERGE statement

Postby NicC » Sat Feb 09, 2019 3:27 pm

1 - Why did you post in Forum Rules? - topic moved
2 - Why did you not use the code tags? - coded
3 - Why did you not research how to use the forum before posting?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2849
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 121 times

Re: DB2 MERGE statement

Postby satyabrata » Fri Feb 15, 2019 7:30 pm

Hello All,

Extremely sorry for posting the query in wrong forum.

Regards
Satyabrata Dash
satyabrata
 
Posts: 2
Joined: Fri Feb 08, 2019 8:08 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post