I have a df:
Col1 col2
1222 abc
--- bbb
111 nmnm
Whenever I detect ---
in Col1 I want to convert that to NULL, how to do that?
Tried so far:
select replace(Col1, '---', NULL) from df
But even after this the original table is unchanged
You need to update the table:
UPDATE df
SET Col1 = NULL
WHERE Col1 = '---';
As for ad-hoc query:
select replace(Col1, '---', NULL) from df
<->
select nullif(col1, '---') AS col1 from df;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.