the database schema
Code: Select all
create table items (
id serial,
name varchar(100),
mfg_date date,
);
INSERT INTO items (name) VALUES ('ABC');
Code: Select all
pgQuery.Close;
pgQuery.SQL.Text := 'SELECT * FROM items WHERE name = :name AND mfg_date = :mfg_date';
pgQuery.ParamByName('name').Value := 'ABC';
pgQuery.ParamByName('mfg_date').Value := null;
pgQuery.ParamByName('mfg_date').Bound := True;
pgQuery.Open;
Even i turn on the transform_null_equals inside postgresql, the result also wrong. So, what is the right approach to handle parameters with null values?