IF purpose = null THEN
v_purpose := '';
ELSE
v_purpose := ' for ' || purpose;
END IF;
When purpose is null, it still goes to the else…why?!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The correct test is
This is because
NULLis not a value stored in a field. It is an attribute about the field stored elsewhere (but within in the row).Setting a field to
NULLappears to be an ordinary assignment so it is seems perfectly orthogonal to expect testing for it by direct comparison. However, for it to work as it does, I surmise the SQL assignment primitive has a magic hidden aspect which diverts assignment of the special symbolNULLinto setting an attribute and not the field.