Jaymol
asked on
Null date for Oracle procedure.
Hi.
I'm passing a load of variables to an Oracle 8 stored procedure, but I'm having problems with one of them.
Does anyone know if there are issues with passing a date field a null value from Delphi? Without going into loads of detail I can't give you much more info. Unfortunately the code is not mine to give out (even though I wrote it), so I'll just have to rely on your understanding of my explanation.
Thanks,
John.
I'm passing a load of variables to an Oracle 8 stored procedure, but I'm having problems with one of them.
Does anyone know if there are issues with passing a date field a null value from Delphi? Without going into loads of detail I can't give you much more info. Unfortunately the code is not mine to give out (even though I wrote it), so I'll just have to rely on your understanding of my explanation.
Thanks,
John.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Meikl,
Just out of curiosity, why are you using ParamByName? Is it okay to use .Clear with the Values array?
John.
Just out of curiosity, why are you using ParamByName? Is it okay to use .Clear with the Values array?
John.
ASKER
Actually, either way doesn't make any difference in this case. I get the following error message when using the .Clear proc.
"Variant does not reference an automation object"
o be perfectly honest with you, I could be doing this whole thing wrong as I've never used a TStoredProc before, but I don't think that's the case.
Any more thoughts?
John.
"Variant does not reference an automation object"
o be perfectly honest with you, I could be doing this whole thing wrong as I've never used a TStoredProc before, but I don't think that's the case.
Any more thoughts?
John.
ASKER
That was it! I just did it wrong.
I did this....
StoredProc1.Params[3].Valu e.Clear;
which raise the exception. If I now do this....
StoredProc1.Params[3].Clea r;
it works fine. Now I'm just getting an error directly from the Stored Procedure which means that Delphi has passed everything correctly.
I appreciate the help Meikl, but if you've got any advice on using stored procs, or any suggestions as to usual pitfalls etc., I'd be very grateful for your help.
Thanks again,
John.
I did this....
StoredProc1.Params[3].Valu
which raise the exception. If I now do this....
StoredProc1.Params[3].Clea
it works fine. Now I'm just getting an error directly from the Stored Procedure which means that Delphi has passed everything correctly.
I appreciate the help Meikl, but if you've got any advice on using stored procs, or any suggestions as to usual pitfalls etc., I'd be very grateful for your help.
Thanks again,
John.
well, jaymol,
first, glad that i helped you
and thanks for the points ;-)
and yes just ask if you have
problems with storedprocs,
i've used it a lot
why i use parambyname?
its just a safety issue,
because if the storedproc is changed
on the server by maybe inserted a param before or
reordering the params i will got allways the right parameter, where i have to provide or to get a value
well, if the parameter is renamed then i have also lost :-)
meikl ;-)
first, glad that i helped you
and thanks for the points ;-)
and yes just ask if you have
problems with storedprocs,
i've used it a lot
why i use parambyname?
its just a safety issue,
because if the storedproc is changed
on the server by maybe inserted a param before or
reordering the params i will got allways the right parameter, where i have to provide or to get a value
well, if the parameter is renamed then i have also lost :-)
meikl ;-)
ASKER
Makes sense.
Thanks for the advice & help,
John.
Thanks for the advice & help,
John.
...
if MyTDateTimeTypVar = 0 then //or what condition you have
storedProc1.ParamByName('D
else
storedProc1.ParamByName('D
...
meikl ;-)