Change column value when matching condition
oracle, sql
Solution
So as I though you want a select statement.
select case when (parent is null and flag01 = 'OK' and flag02 = 'OK')
then 'CT_00000'
else parent end as columnSomeName,
Child, flag01, lag02
from yourTable
Problem
I need to replace a `NULL` value in a column only when other conditions are matched. ``` Columns: Parent, Child, flag01, lag02 ``` Parent columns has many `NULL` values, but I want to replace the `null` values only when `flag01` and `flag02` is "ok". If `flag01` and `flag02` are both "`Ok`" and Parent is NULL, replace to 'CT_00000'. Else, keep the original value (when NOT NULL).