SQL 合并不起作用



嗨,我遵循了 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 是一个 DB2 关键字。我把它改成另一个词,就像宝石一样工作。为什么IBM会在他们的官方文档中给出这样的例子???

因此,

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. 

最新更新