I have a stored procedure which has 4 input parameters.
An input parameter may not have a value.
I have the WHERE clause coded as follows:
where field1 like 'p1'||'%'
and field2 like 'p2'||'%'
and field3 like 'p3'||'%'
and field4 like 'p4'||'%'
Where p1,p2,p3,p4 are the input parameters.
Now, if one input parameter p1 value is NULL, then it does not retrieve records from the table where field1 value is null since like '%' does not retrieve NULL values.
How can I modify my above query so that even if the table has like '%', it will retrieve the records from the table where the field values are NULL.
Please help. Thanks.
An input parameter may not have a value.
I have the WHERE clause coded as follows:
where field1 like 'p1'||'%'
and field2 like 'p2'||'%'
and field3 like 'p3'||'%'
and field4 like 'p4'||'%'
Where p1,p2,p3,p4 are the input parameters.
Now, if one input parameter p1 value is NULL, then it does not retrieve records from the table where field1 value is null since like '%' does not retrieve NULL values.
How can I modify my above query so that even if the table has like '%', it will retrieve the records from the table where the field values are NULL.
Please help. Thanks.