I have two tables TAB_A and TAB_B. I want to update COL_1 in TAB_A to a
certain value but only for rows where the value COL_2 in TAB_A is also found
in COL_2 of TAB_B.
This is what I have but it seems to then set COL_1 of TAB_A to a NULL if its
not found in TAB_B. In this case I just want to leave that row unchanged.
UPDATE tab_a
SET col_1 = 'NEWVALUE'
WHERE EXISTS (SELECT 1
FROM tab_a a, tab_b b
WHERE a.col_2 = b.col_2)
AND col_1 IS NULL;
Any ideas to what I'm doing wrong?
--
Cheers,
elziko
certain value but only for rows where the value COL_2 in TAB_A is also found
in COL_2 of TAB_B.
This is what I have but it seems to then set COL_1 of TAB_A to a NULL if its
not found in TAB_B. In this case I just want to leave that row unchanged.
UPDATE tab_a
SET col_1 = 'NEWVALUE'
WHERE EXISTS (SELECT 1
FROM tab_a a, tab_b b
WHERE a.col_2 = b.col_2)
AND col_1 IS NULL;
Any ideas to what I'm doing wrong?
--
Cheers,
elziko
Comment