SELECT MAX(date)
FROM abc
WHERE
p_id=p_p_id
AND nvl(c_number,0)=nvl(p_c_number,0)
AND nvl(m_number,0)=nvl(p_m_number,0)
AND nvl(s_number,0)=nvl(p_s_number,0);
In the above query p_p_id,p_c_number,p_m_number & p_s_number is passed to this query ,but this query gives the wrong output in certain condition: in table abc c_number ,m_number,s_number can be null ,zero or any other value i want to match c_number if null with p_c_number if null but the problem with the above query is ,in case if c_number is null the zero is assigned to c_number and if p_c_number is already zero then it matches null with zero value please help ..i am using oracle as rdbms
is null
? (e.g.x is null and y is null
-- of course, perhaps Oracle has some trickery to do the above. TheCOALESCE
orIFNULL
can even be used --COALESCE(a,b) IS NULL
is true only whena
andb
are null -- but just KISS. – user166390