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 15C82102FA for ; Tue, 11 Mar 2014 19:03:53 +0000 (UTC) Received: (qmail 54173 invoked by uid 500); 11 Mar 2014 19:03:50 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 53917 invoked by uid 500); 11 Mar 2014 19:03:45 -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 53808 invoked by uid 99); 11 Mar 2014 19:03:44 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Mar 2014 19:03:44 +0000 Date: Tue, 11 Mar 2014 19:03:44 +0000 (UTC) From: "Rick Hillegas (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=3D1393= 0789#comment-13930789 ]=20 Rick Hillegas commented on DERBY-3155: -------------------------------------- Thanks for that advice, Mike. The derby-3155-38-aa-datatypes.diff patch tes= ted small lobs (just a handful of bytes) and the derby-3155-40-aa-bigLobs.d= iff patch tested lobs which were 100K bytes or larger. Thanks. > 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, MergeStatement.html, derby-3155-01-ac-grammar.diff, derby-3155-0= 2-ag-fixParserWarning.diff, derby-3155-03-ae-backingStoreHashtableWithRowLo= cation.diff, derby-3155-03-af-backingStoreHashtableWithRowLocation.diff, de= rby-3155-03-ag-backingStoreHashtableWithRowLocation.diff, derby-3155-03-ah-= backingStoreHashtableWithRowLocation.diff, derby-3155-04-ae-deleteAction.di= ff, derby-3155-04-af-deleteAction.diff, derby-3155-05-aa-triggerTransitionT= ableAsTarget.diff, derby-3155-06-aa-triggerTransitionTableAsSource.diff, de= rby-3155-07-ad-insertAction.diff, derby-3155-08-ah-updateAction.diff, derby= -3155-09-aa-correlationNames.diff, derby-3155-10-aa-correlationNames.diff, = derby-3155-11-ab-beforeTriggersCantFireMerge.diff, derby-3155-12-aa-canOmit= InsertColumnList.diff, derby-3155-13-aa-allowSystemAndTempTables.diff, derb= y-3155-14-aa-replaceCorrelationNamesOnLeftSideOfSETclauses.diff, derby-3155= -15-aa-replumbMergeResultSetCleanup.diff, derby-3155-16-aa-treatCurrentRowL= ocationNodeLikeBaseColumnNode.diff, derby-3155-17-aa-serializingRowLocation= s.diff, derby-3155-18-aa-basicView.diff, derby-3155-19-aa-forbidSubqueriesI= nMatchedClauses.diff, derby-3155-20-aa-reworkColumnMatching.diff, derby-315= 5-21-ac-cleanupAndForbidSynonyms.diff, derby-3155-22-ad-testIdentifiersOnLe= ftSideOfSetClauses.diff, derby-3155-23-aa-forbidDerivedColumnLists.diff, de= rby-3155-24-aa-supportParameters.diff, derby-3155-25-aa-parametersAsInsertV= alues.diff, derby-3155-26-aa-copyRowLocationForIndexScans.diff, derby-3155-= 27-aa-adjustMatchingRefinements.diff, derby-3155-28-aa-cardinalityViolation= s.diff, derby-3155-29-aa-missingSchema.diff, derby-3155-30-ab-moreCorrelati= onNames.diff, derby-3155-31-aa-deletePrivs.diff, derby-3155-32-aa-newTestFu= nction.diff, derby-3155-33-ab-insertPrivs.diff, derby-3155-34-aa-updatePriv= s.diff, derby-3155-34-ab-updatePrivs.diff, derby-3155-35-aa-allPrivsTest.di= ff, derby-3155-36-aa-lockModeComment.diff, derby-3155-37-aa-printSubNodes.d= iff, derby-3155-38-aa-datatypes.diff, derby-3155-39-aa-fixBuild.diff, derby= -3155-40-aa-bigLobs.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.2#6252)