Pass NULL value to query parameters
Posted: Mon 12 Jan 2009 11:27
Hello,
My question seems simple, but I have not found an appropriate answer after a lot of searching:
how can I pass a null-value to a (date-) parameter of a query?
I need to make a selelction on date, but it must also be possible to select records where the datefield is not filled in (Null).
In the sql-text I use someting like: "...LOAD_DATE=:Date1.."
This works OK for normal dates, but I cannot pass NULL as a parameter value, because the SQL syntax must be: "...LOAD_DATE IS NULL.."
and not: "...LOAD_DATE=NULL..".
I can do a workaround by changing the complete SQL text in code, but there must be a simpler way???
Ed van Wijngaarden
My question seems simple, but I have not found an appropriate answer after a lot of searching:
how can I pass a null-value to a (date-) parameter of a query?
I need to make a selelction on date, but it must also be possible to select records where the datefield is not filled in (Null).
In the sql-text I use someting like: "...LOAD_DATE=:Date1.."
This works OK for normal dates, but I cannot pass NULL as a parameter value, because the SQL syntax must be: "...LOAD_DATE IS NULL.."
and not: "...LOAD_DATE=NULL..".
I can do a workaround by changing the complete SQL text in code, but there must be a simpler way???
Ed van Wijngaarden