Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Null date for Oracle procedure.

Posted on 2001-07-20
7
Medium Priority
?
314 Views
Last Modified: 2010-04-06
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.
0
Comment
Question by:Jaymol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 600 total points
ID: 6301760
storedProc1.ParamByName('DateParam').Clear; //will force a null-value
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6301772
more specific

...
if MyTDateTimeTypVar = 0 then  //or what condition you have
  storedProc1.ParamByName('DateParam').Clear
else
storedProc1.ParamByName('DateParam').AsDateTime := MyTDateTimeTypVar;  
...

meikl ;-)
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6301801
Meikl,

Just out of curiosity, why are you using ParamByName?  Is it okay to use .Clear with the Values array?

John.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Author Comment

by:Jaymol
ID: 6301811
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.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6301825
That was it!  I just did it wrong.

I did this....


    StoredProc1.Params[3].Value.Clear;

which raise the exception.  If I now do this....

    StoredProc1.Params[3].Clear;

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.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6301845
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 ;-)
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6301857
Makes sense.

Thanks for the advice & help,

John.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question