0

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

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

From what you posted so far, should be =, not is:

case when pp.phone_number = '0' then ''

is is used for NULLs, e.g. is null or is not null

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.