Skip to content

Conversation

ThoSap
Copy link
Contributor

@ThoSap ThoSap commented Jun 10, 2022

Produces more readable oracle incremental merge/upsert statement

    merge into myschema.test target
      using myschema.o$pt_test120014 temp
      on (temp.my_pk = target.my_pk)
    when matched then
      update set
      target.col1 = temp.col1,
      target.col2 = temp.col2,
      target.col3 = temp.col3
      
    when not matched then
      insert( my_pk, col1, col2, col3 )
      values(
        temp.my_pk,
        temp.col1,
        temp.col2,
        temp.col3
        
      )

instead of

    merge into myschema.test target
      using myschema.o$pt_test120014 temp
      on (temp.my_pk = target.my_pk)
    when matched then
      update set
      
        target.col1 = temp.col1
        , 
      
        target.col2 = temp.col2
        , 
      
        target.col3 = temp.col3
        
      
    when not matched then
      insert( my_pk, col1, col2, col3 )
      values(
       
          temp.my_pk
          , 
       
          temp.col1
          , 
       
          temp.col2
          , 
       
          temp.col3
         
        
      )

ThoSap added 2 commits June 10, 2022 20:51
Signed-off-by: Thomas Sapelza <sapelza.thomas@gmail.com>
Signed-off-by: Thomas Sapelza <sapelza.thomas@gmail.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 10, 2022
@aosingh aosingh merged commit 9d461fe into oracle:release/v1.0.3 Jun 10, 2022
@ThoSap
Copy link
Contributor Author

ThoSap commented Jun 10, 2022

I added one more change (not so important), sorry that I'm late with this one:
ThoSap@1b6bf8e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants