Github user brosander commented on the issue:

    https://github.com/apache/nifi/pull/952
  
    Hey, @paulgibeault,
    
    Thanks for the contribution!  I think this is valuable functionality but 
I'm currently having some issues with it.
    
    I'm currently testing the merge against Oracle express 11g and am having 
some problems.
    
    It's generating the following SQL that Oracle doesn't like:
    
    ```
    MERGE VIOLATIONS target_t 
    USING VALUES (?,?) 
    AS source_t (SUMMONS_NUMBER,PLATE) 
    ON target_t.SUMMONS_NUMBER = source_t.SUMMONS_NUMBER 
    WHEN MATCHED THEN 
    UPDATE SET PLATE = source_t.PLATE 
    WHEN NOT MATCHED THEN 
    INSERT (SUMMONS_NUMBER,PLATE) 
    VALUES (source_t.SUMMONS_NUMBER,source_t.PLATE) 
    ;
    ```
    
    Oracle is complaining that it is missing an INTO keyword after the MERGE.
    
    If I add that manually, it then complains of an invalid table name.  I 
suspect this is due to the "USING VALUES" portion of the query which [doesn't 
appear to be standard](https://en.wikipedia.org/wiki/Merge_(SQL)).
    
    If each database is going to require different SQL for this operation, it 
may warrant its own processor where we can contain all of that custom logic per 
database, possibly with the [DatabaseAdapter 
interface](https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/db/DatabaseAdapter.java)
 (@mattyb149 may have some thoughts around that).
    
    If you'd like to repro my tests, here is a link to the [Oracle docker 
container](https://github.com/brosander/dev-dockerfiles/tree/master/sample-data/nyc_traffic_violations/oracle-xe-11g)
 and here is one to [my 
flow.xml.gz](https://blog.rosander.ninja/attachments/random/2016/11/08/flow.xml.gz)
 and [test.json 
file](https://blog.rosander.ninja/attachments/random/2016/11/08/test.json).
    
    Thanks,
    Bryan


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to