Search code examples
sqlmerge-statementexasol

Hash_md5() in not working while merging in Exasol


I'm trying to merge and update target table based on Hash_val. but i'm getting below error. Such merge condition is not supported. below is the code.

merge into table1 as t1 
using table2 as t2
on hash_md5(t1.col1||t1.col2||t1.col3)=hash_md5(t2.col1||t2.col2||t2.col3)
when matched then
update t1.col4='XYZ' 

Solution

  • What about breaking up the join condition of the merge into it's subparts

    merge into table1 as t1 
    using table2 as t2
    on t1.col1=t2.col1
    and t1.col2=t2.col2
    and t1.col3=t2.col3
    
    when matched then update set t1.col4='XYZ'  
    

    This should effectively do the same as a join on a concat-single criterion.