Subject | Re: [ib-support] setNull doesn't work |
---|---|
Author | Martijn Tonies |
Post date | 2002-07-30T08:35:23Z |
Claudio,
Please read again ...
Your statement is this, right?
select *
from mytable
where mycolumn = ?
Then, you can set the value of the parameter any way you like, right?
For example:
5 -> which results in a statement to be executed:
select *
from mytable
where mycolumn = 5
This can return a row.
Now, if you use setNull, the statement results in:
select *
from mytable
where mycolumn = NULL
Now, this does NOT work - the setNull method works (it sets the VALUE of the
parameter to NULL) - but the query will never return any rows, because the
SQL WHERE clause ( where mycolumn = NULL ) never results into TRUE.
The only way to test if a column is NULL, is like this:
where mycolumn is null
Please read the above and ask specific questions about what you don't
understand.
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
Please read again ...
Your statement is this, right?
select *
from mytable
where mycolumn = ?
Then, you can set the value of the parameter any way you like, right?
For example:
5 -> which results in a statement to be executed:
select *
from mytable
where mycolumn = 5
This can return a row.
Now, if you use setNull, the statement results in:
select *
from mytable
where mycolumn = NULL
Now, this does NOT work - the setNull method works (it sets the VALUE of the
parameter to NULL) - but the query will never return any rows, because the
SQL WHERE clause ( where mycolumn = NULL ) never results into TRUE.
The only way to test if a column is NULL, is like this:
where mycolumn is null
Please read the above and ask specific questions about what you don't
understand.
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
> The driver doesn't communicate with SQL but with its machine language.
>
> However MYCOLUMN=NULL don't work in interbase becouse it's a syntax error.
> JDBC Driver' interbase should communicate traslating the setNull in
> MYCOLUMN in null
>
> At 10.08 30/07/2002 +0200, you wrote:
>
> > > But this is a bug, don't you?
> >
> >No it's not. I explained that to you. There's no such thing as
> >MYCOLUMN = NULL --- this does not work. If you replace NULL
> >by a parameter and set it to NULL, it will still not work.