I have this bit of code in my query, when I remove it then it works fine, if I keep it in I get a
"ORA-00908: missing NULL keyword"
message.
CASE WHEN pp.phone_number is '0' THEN ''
I have other When - Then and an END statement in there so it's not that.
The whole code, in case you wanted to see is:
CASE WHEN pp.country_code_number = 44 THEN '0'||SUBSTR(REGEXP_REPLACE(pp.phone_number, '[^0-9]+', ''),-10)
WHEN pp.country_code_number IS NULL THEN '0'||SUBSTR(REGEXP_REPLACE(pp.phone_number, '[^0-9]+', ''),-10)
WHEN pp.phone_number is '0' THEN ''
WHEN pp.phone_number is NULL THEN 'Blank'
ELSE '***ERROR***'
END
Thanks all
IS
is only used to check NULL
; for example
CASE WHEN pp.phone_number IS NULL THEN …
What you need is:
CASE WHEN pp.phone_number = '0' THEN ''
…
As an aside, you are using a string ( '0'
) that looks like a number; maybe you need to check your types.
From what you posted so far, should be =
, not is
:
case when pp.phone_number = '0' then ''
is is used for NULLs, eg is null
or is not null
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.