Hi All,
I am trying to make a MERGE which involves columns with NULL values. Here a simple example:
CREATE TABLE test_merge_dst AS
SELECT 0 AS id, 'Foo' AS name, 'Bar' AS surname1, NULL AS surname2
CREATE TABLE test_merge_src AS
SELECT 0 AS id, 'Foo' AS name, 'Bar' AS surname1, NULL AS surname2
MERGE INTO test_merge_dst AS dst USING test_merge_src src ON
(src.id = dst.id AND src.name = dst.name AND src.surname1 = dst.surname1 AND src.surname2 = dst.surname2)
WHEN NOT MATCHED THEN INSERT (id, name, surname1, surname2) VALUES (src.id, src.name, src.surname1, src.surname2)
The expected result from this merge is NO merge, since I am merging the same values for a single row. The result is this:
| id | name | surname1 | surname2 |
|---|---|---|---|
| 0 | Foo | Bar | [NULL] |
| 0 | Foo | Bar | [NULL] |
Why does this happen ?, I've been reading the documentation but no reference to NULL values are found.
Regards