How should I deal with null parameters in a PL/SQL stored procedure when I want to use them in comparisons?

前端 未结 6 1153
孤独总比滥情好
孤独总比滥情好 2021-01-05 14:31

I have a stored procedure with a parameter name which I want to use in a where clause to match the value of a column i.e. something like

         


        
6条回答
  •  误落风尘
    2021-01-05 15:15

    What you have done is correct. There is a more concise way, but it isn't really better:

    where nvl(col1,'xx') = nvl(name,'xx')
    

    The trouble is, you have to make sure that the value you use for nulls ('xx' is my example) couldn't actually be a real value in the data.

提交回复
热议问题