Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2975C10E6A for ; Tue, 21 Jan 2014 18:38:38 +0000 (UTC) Received: (qmail 51519 invoked by uid 500); 21 Jan 2014 18:38:34 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 51453 invoked by uid 500); 21 Jan 2014 18:38:31 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 51340 invoked by uid 99); 21 Jan 2014 18:38:22 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jan 2014 18:38:22 +0000 Date: Tue, 21 Jan 2014 18:38:22 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: derby-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DERBY-3155) Support for SQL:2003 MERGE statement MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-3155?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1387= 7708#comment-13877708 ]=20 ASF subversion and git services commented on DERBY-3155: -------------------------------------------------------- Commit 1560134 from [~rhillegas] in branch 'code/trunk' [ https://svn.apache.org/r1560134 ] DERBY-3155: Allow for row location columns in the result column list of bas= e tables; tests passed cleanly for me on derby-3155-16-aa-treatCurrentRowLo= cationNodeLikeBaseColumnNode.diff. > Support for SQL:2003 MERGE statement > ------------------------------------ > > Key: DERBY-3155 > URL: https://issues.apache.org/jira/browse/DERBY-3155 > Project: Derby > Issue Type: Improvement > Components: SQL > Reporter: Trejkaz > Assignee: Rick Hillegas > Labels: derby_triage10_10 > Attachments: MergeStatement.html, MergeStatement.html, MergeState= ment.html, derby-3155-01-ac-grammar.diff, derby-3155-02-ag-fixParserWarning= .diff, derby-3155-03-ae-backingStoreHashtableWithRowLocation.diff, derby-31= 55-03-af-backingStoreHashtableWithRowLocation.diff, derby-3155-03-ag-backin= gStoreHashtableWithRowLocation.diff, derby-3155-03-ah-backingStoreHashtable= WithRowLocation.diff, derby-3155-04-ae-deleteAction.diff, derby-3155-04-af-= deleteAction.diff, derby-3155-05-aa-triggerTransitionTableAsTarget.diff, de= rby-3155-06-aa-triggerTransitionTableAsSource.diff, derby-3155-07-ad-insert= Action.diff, derby-3155-08-ah-updateAction.diff, derby-3155-09-aa-correlati= onNames.diff, derby-3155-10-aa-correlationNames.diff, derby-3155-11-ab-befo= reTriggersCantFireMerge.diff, derby-3155-12-aa-canOmitInsertColumnList.diff= , derby-3155-13-aa-allowSystemAndTempTables.diff, derby-3155-14-aa-replaceC= orrelationNamesOnLeftSideOfSETclauses.diff, derby-3155-15-aa-replumbMergeRe= sultSetCleanup.diff, derby-3155-16-aa-treatCurrentRowLocationNodeLikeBaseCo= lumnNode.diff > > > A relatively common piece of logic in a database application is to check = for a row's existence and then either update or insert depending on its exi= stence. > SQL:2003 added a MERGE statement to perform this operation. It looks lik= e this: > MERGE INTO table_name USING table_name ON (condition) > WHEN MATCHED THEN UPDATE SET column1 =3D value1 [, column2 =3D value2= ...] > WHEN NOT MATCHED THEN INSERT column1 [, column2 ...] VALUES (value1 [= , value2 ...])=20 > At the moment, the only workaround for this would be to write a stored pr= ocedure to do the same operation, or to implement the logic client-side. -- This message was sent by Atlassian JIRA (v6.1.5#6160)