SQL Merge无法正常工作

时间:2017-02-10 05:14:50

标签: db2 ibm-midrange

您好我已经关注了MERGE的DB2文档(https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/sqlp/rbafymerge.htm)并提出了以下声明。

MERGE INTO TEMP2 target USING TEMP1 source 
     ON target.ITNBR = source.ITNBR        
          AND target.STID = source.STID    
          AND target.ITRV = source.ITRV    
WHEN NOT MATCHED THEN                      
   INSERT VALUES(TEMP1.*)                  
WHEN MATCHED THEN                          
   UPDATE SET ITNBR = source.ITNBR   

但是由于以下错误而失败:

关键字SOURCE未预料到。有效代币:完全左侧交叉内部装备

我不明白这里错了什么。有人可以帮忙吗?

2 个答案:

答案 0 :(得分:2)

所以问题是因为SOURCE是一个DB2关键字。我改成了另一个词,就像宝石一样。为什么IBM会在他们的官方文档中提供这样的例子?

答案 1 :(得分:0)

因此,IBM已经确认这是一个问题,并已同意在未来版本中进行纠正:

From: Nathan R Skalsky [mailto:skalsky@us.ibm.com] 
Sent: Tuesday, February 14, 2017 4:34 AM
To: Thejwal Pavithran <Thejwal.Pavithran@polaris.com>
Subject: RE: Feedback to IBM Knowledge Center - Content page/ssw_ibm_i_71/IBM i 7.1

Hi Thejwal, 

Unfortunately, this is not our normal channel of communication; Therefore, I will not be posting to the specified thread.
Your welcome to communicate it.

Thanks,

Nathan R. Skalsky
IBM i Software Engineer - DB2 for IBM i Development
________________________________________

E-mail: skalsky@us.ibm.com
Internal: Nathan R Skalsky/Rochester/IBM 


3605 Hwy 52 N
Rochester, MN 55901-1407
United States





From:        Thejwal Pavithran <Thejwal.Pavithran@polaris.com>
To:        Nathan R Skalsky/Rochester/IBM@IBMUS
Date:        02/13/2017 11:53 AM
Subject:        RE: Feedback to IBM Knowledge Center - Content page/ssw_ibm_i_71/IBM i 7.1
________________________________________



Thanks Nathan!

Would be great if you could post a reply on the Stack Overflow thread for the sake of all users.

Thanks,
Thejwal


      Thejwal Pavithran | IBMi Developer
        7th Floor, ‘Electra’, Wing A, Prestige Tech Park, Marathalli| Bangalore – 560103 | Karnataka
        Direct line: | Cell: +91 9620661497
        thejwal.pavithran@Polaris.com| www.polaris.com

From: Nathan R Skalsky [mailto:skalsky@us.ibm.com] 
Sent: Monday, February 13, 2017 11:21 PM
To: Thejwal Pavithran <Thejwal.Pavithran@polaris.com>
Subject: Feedback to IBM Knowledge Center - Content page/ssw_ibm_i_71/IBM i 7.1 

Hi Theywal,

Thank you for your bringing this to my attention.  We will fix this in a future technical refresh (TR) of  the SQL Programming topic in 7.2 and 7.3.
The fix will remove the word SOURCE from these examples.

Thanks,

Nathan R. Skalsky
IBM i Software Engineer - DB2 for IBM i Development
________________________________________

E-mail: skalsky@us.ibm.com
Internal: Nathan R Skalsky/Rochester/IBM 


3605 Hwy 52 N
Rochester, MN 55901-1407
United States




Thejwal Pavithran ---02/12/2017 03:08:33 AM---Hi Team, Have come across a minor issue in DB2 MERGE syntax at below page.

From: Thejwal Pavithran <Thejwal.Pavithran@polaris.com>
To: IBM Knowledge Center/Pittsburgh/IBM@IBMUS
Date: 02/12/2017 03:08 AM
Subject: Feedback to IBM Knowledge Center - Content page/ssw_ibm_i_71/IBM i 7.1
________________________________________




Hi Team, 
Have come across a minor issue in DB2 MERGE syntax at below page.
URL: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/sqlp/rbafymerge.htm
Issue described here:
http://stackoverflow.com/questions/42151989/sql-merge-not-working/42152283?noredirect=1#comment71511658_42152283
Please attempt to rectify.
Thanks,
Thejwal


     Thejwal Pavithran | IBMi Developer
       7th Floor, ‘Electra’, Wing A, Prestige Tech Park, Marathalli| Bangalore – 560103 | Karnataka
       Direct line: | Cell: +91 9620661497
       thejwal.pavithran@Polaris.com| www.polaris.com


Thanks,

Nathan R. Skalsky
IBM i Software Engineer - DB2 for IBM i Development
________________________________________

Phone:(507) 253-1685
T/L: (507) 553-1685
Fax: (507) 253-4728
Office: 15-3 C118
E-mail: skalsky@us.ibm.com
Internal: Nathan R Skalsky/Rochester/IBM 


3605 Hwy 52 N
Rochester, MN 55901-1407
United States

CONFIDENTIAL: The information contained in this email communication is confidential information intended only for the use of the addressee. Unauthorized use, disclosure or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return email and destroy all copies of this communication, including all attachments.