Archive for November 2006

Passing NULL as InterBase stored procedure parameter

November 22, 2006

I had to pass a NULL value to an InterBase stored procedure. OK, first I tried:

IBStoredProc1.ParamByName('param1').Clear();

That ended up with ‘Required parameter not set’ SQL error. One has to ‘bind’ the parameter manually:

IBStoredProc1.ParamByName('param1').Clear();
IBStoredProc1.ParamByName('param1').Bound := True;

Another solution I came up while trying to figure out the “Bound := True” fix, is simply to use:

IBStoredProc1.ParamByName('param1').Value := null;

Believe it or not, this one works as well 🙂

Advertisements