Subject | Re: [Firebird-Java] delete with null not executed |
---|---|
Author | Roman Rokytskyy |
Post date | 2009-01-20T10:47:55Z |
Hi,
have no entry where one of the listed fields contains NULL.
Note, setting parameter to NULL does not tell server to ignore the
parameter condition, but to match the record with NULL in the specified
field.
Roman
> DELETE FROM "Prezzi" WHERE PR_IDORG=? AND PR_IDEVE=? AND PR_OP=? ANDIf you get 0, it means that the logic in your DELETE is wrong and you
> PR_TT=? AND PR_CAUSALE=?
>
> I set the parameters using setObject(index, value)
>
> The query is executed as a preparedStatement.executeUpdate()
>
> My problem is that the preparedStatement.executeUpdate()
> returns 1 (success since i delete 1 record at a time) only when all
> the parameters are not null (in this case it returns 0).
have no entry where one of the listed fields contains NULL.
Note, setting parameter to NULL does not tell server to ignore the
parameter condition, but to match the record with NULL in the specified
field.
> Looking at the driver code it seems that using setNull is pointlessCorrect.
> since setObject can handle nulls by itself.
Roman