Greetings. please let me ask for some brain storming:
I have a table COUNTER_PARTY and a matching staging table IMP_COUNTERPARTY. Now I want to find any records of COUNTER_PARTY which will need to be updated according to IMP_COUNTERPARTY by comparing all the columns. If one of the columns has a different value, I would need to update the record in COUNTER_PARTY. So far, so simple -- unless NULLs enter the stage, because always: NULL != NULL. What would be the most efficient way to check, if two values are equal or both are NULL without writing this out verbosely: select * from COUNTER_PARTY a left join IMP_COUNTERPARTY b on a.id = b.id where ( a.name != b.name or (a.name is null and b.name is null) ) or ( a.first_name != b.first_name or (a.first_name is null and b.first_name is null) ) I know, that for Strings I can write it as NVL( a.name, '') != NVL( b.name, '') However, this fails for DECIMALS, e.g. NVL( a.age, 0) != NVL( b.age, 0) wont work when age is defined as DECIMAL(3,0) Can't we have a simplified Compare() or Equal() function? Thank you for any input, best regards Andreas -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/h2-database/9d5b77d808f333256e648a894c6d8fc60bd63bf3.camel%40manticore-projects.com.
