kashipai / h2database

H2 Database for reference.
0 stars 0 forks source link

Support for MERGE statement in Oracle compatibility mode #440

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please support Oracle style MERGE statement, at least when in Oracle 
compatibility mode.

For example, given table like:

CREATE TABLE "MERCHANT"
(
   MID varchar2(128) PRIMARY KEY NOT NULL,
   LNET varchar2(10) NOT NULL,
   FIID varchar2(16),
   SIC_CDE varchar2(10),
   NAME varchar2(256),
   OPENDATE date,
   ZIPCODE varchar2(10),
   CITY varchar2(32)
);

I would like to be able to execute following sql (please note that it's 
pseudocode with placeholders):

MERGE INTO MERCHANT USING dual ON (MID=:mid) 
WHEN MATCHED THEN
UPDATE SET LNET=:lnet, 
FIID=:fiid,SIC_CDE=:siccde,NAME=:name,OPENDATE=:opndate,ZIPCODE=:zipcode,CITY=:c
ity 
WHEN NOT MATCHED THEN INSERT (MID,LNET,FIID,SIC_CDE,NAME,OPENDATE,ZIPCODE,CITY) 
VALUES (:mid, :lnet, :fiid, :siccde, :name, :opndate, :zipcode, :city)

Oracle documentation: 
http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9016.htm#SQLRF0
1606

Thanks!

Original issue reported on code.google.com by ivica.lo...@gmail.com on 11 Feb 2013 at 4:27

GoogleCodeExporter commented 9 years ago
Sorry I will not work in this. Patches are welcome!

Original comment by thomas.t...@gmail.com on 23 Feb 2013 at 4:42

GoogleCodeExporter commented 9 years ago

Original comment by noelgrandin on 6 Mar 2013 at 5:05