db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-3155) Support for SQL:2003 MERGE statement
Date Mon, 26 Aug 2013 13:50:52 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13750091#comment-13750091
] 

Rick Hillegas commented on DERBY-3155:
--------------------------------------

Thanks for spotting that JavaCC warning, Knut. I turned on verbose compilation and saw the
same warning on the trunk at the point where I last sync'd. However, I don't see that warning
after applying the trivial grammar change which addressed a previous problem you discovered:
lack of support for multiple MATCHED clauses. After making that trivial grammar change, the
verbose parser output looks like this for me:

genParser:
     [echo]   Generating SQL parser...
     [java] Java Compiler Compiler Version 4.0 (Parser Generator)
     [java] (type "javacc" with no arguments for help)
     [java] Reading from file sqlgrammar.jj . . .
     [java] Note: UNICODE_INPUT option is specified. Please make sure you create the parser/lexer
using a Reader with the correct character encoding.
     [java] File "TokenMgrError.java" does not exist.  Will create one.
     [java] File "ParseException.java" does not exist.  Will create one.
     [java] File "Token.java" does not exist.  Will create one.
     [java] File "CharStream.java" does not exist.  Will create one.
     [java] Parser generated successfully.

So I think that the parser warning will disappear on trunk when I submit my next patch. 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: derby-3155-01-ac-grammar.diff, MergeStatement.html, MergeStatement.html,
MergeStatement.html
>
>
> 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 existence.
> SQL:2003 added a MERGE statement to perform this operation.  It looks like this:
>     MERGE INTO table_name USING table_name ON (condition)
>     WHEN MATCHED THEN UPDATE SET column1 = value1 [, column2 = value2 ...]
>     WHEN NOT MATCHED THEN INSERT column1 [, column2 ...] VALUES (value1 [, value2 ...])

> At the moment, the only workaround for this would be to write a stored procedure to do
the same operation, or to implement the logic client-side.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message