create table "My_Table" ("Date_One" Date not null, "Date_Two" Date);
set term ^ ;
create procedure "My_Stored_Proc" (A_Date Date, Another_Date Date)
as
begin
insert into My_Table (Date_One, Date_Two) values (:A_Date,
:Another_Date);
end
^
set term ; ^
In the above example I would expect a null in the 'A_Date' parameter would
cause an error as the table requires a value to be present in the field
'Date_One'. But I did not expect an error when setting the 'Another_Date'
parameter to null as the table doesn't require a value in the 'Date_Two'
field.
To set the parameter null in the TIBStoredProc I tried using the Clear
method as well as assigning the Variant property to null.
I played around a bit and found that if I placed the line
Another_Date = null;
just before the insert query then there would be no error.
I have used a TIBQuery with parameters set to null before and they have
worked fine. Can some one please help me. I would much rather used stored
than queries so as to keep the logic on the server.
Cheers,
Nick Barrett
What is the error (exact text, please) and what is your code?
-Craig
--
Craig Stuntz (TeamB) · Vertex Systems Corp. · Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
Delphi/InterBase WebLog: http://delphi.weblogs.com
Continuing the example in my original post, here is some code that I use:
with dmMyDMod.spIBInsertNewDates do
begin
ParamByName('A_Date').AsDateTime := Date;
ParamByName('Another_Date').Clear;
ExecProc;
end;
The error arises upon calling the ExecProc method.
Cheers,
Nick Barrett
"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote in message
news:3C0F870A.9A46A25E@no_spam.vertexsoftware.com...
After you call TParam.Clear you need to set TParam.Bound := TRUE. It's
designed this way for some odd reason.
Dan
"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote in message
news:3C0FE773.A8610C68@no_spam.vertexsoftware.com...
Cheers,
Nick Barrett
"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote in message
news:3C0FE773.A8610C68@no_spam.vertexsoftware.com...
Cheers,
Nick Barrett
"Dan Palley" <d...@trams.com> wrote in message news:3c0fe983$1_1@dnews...