passing null to a string parameter

Avatar
  • updated
  • Completed
I have recently discovered the ability to pass parameters to a query using the : notation. My question is: How can I specify that a string parameter must be assigned to null (if I pass simply null, it is interpreted as the string 'null' and not the null value)?

Thanks
Avatar
Anonymous
Thank you for your suggestion. We will make a checkbox to allow this in one of the next minor versions.
Avatar
Anonymous
We tried to implement this feature, but have realized that it doesn't work as expected. The reason is that the result of comparison with null is always null, so there will be no data displayed if you've set the null value for a parameter even if the compared filed contains null values. To select Null fields you should use the "Field IS NULL"  condition.
Avatar
zermelo
There is at least a case where the functionality can be useful. Consider this query

select *
from t
where
(:fld is null or :fld = t.fld) and <other conditions>

If :fld is null the expression :fld=t.fld is not checked but the other conditions are checked!
Avatar
Anonymous
This works. We will consider your feature for implementation in one of the next versions.
Avatar
Anonymous
We have improved the parameters dialog to allow for bypassing some of the parameters. Replacing the parameter with null is not planned for now.