Board index » delphi » Saving a NULL to RDB Oracle using TParam ???

Saving a NULL to RDB Oracle using TParam ???

How can I save a NULL in a field of type BIGINT using TParam and an SQL
UPDATE?  I have been using the following line of code but keep getting a
zero (0) saved to the database instead of a NULL.  HELP!!!!!!!!!!!!!!!!

...
aQuery.ParamByName( 'SOMEFIELD' ).Value := NULL;
...
aQuery.ExecSQL;

 

Re:Saving a NULL to RDB Oracle using TParam ???


Quote
David Katauskas <dkata...@rdisoft.com> wrote:
>How can I save a NULL in a field of type BIGINT using TParam and an SQL
>UPDATE?  I have been using the following line of code but keep getting a
>zero (0) saved to the database instead of a NULL.  HELP!!!!!!!!!!!!!!!!
>aQuery.ParamByName( 'SOMEFIELD' ).Value := NULL;

Use the CLEAR method of the TParam object. It's nicely documented in
the help file for Delphi, you know ...........

        aQuery.ParamByName( 'SOMEFIELD' ).Clear;

This puts the "NULL" value into the param.

Marc

PS: Is it really too much to ask the people here to READ THE HELP FILE
first before posting this type of question around the world????

======================================================================
[ Marc Scheuner, marc.scheu...@berner.ch  CH-3001 BERNE, Switzerland ]
======================================================================

Re:Saving a NULL to RDB Oracle using TParam ???


Use
  ParamByName('SOMEFIELD').Clear;

this should pass NULL.

--
Peter Antypas
To reply via e-mail, remove the '==' symbol from my domain name

David Katauskas <dkata...@rdisoft.com> wrote in article
<33AA82A6.2...@rdisoft.com>...

Quote
> aQuery.ParamByName( 'SOMEFIELD' ).Value := NULL;
> ...
> aQuery.ExecSQL;

Other Threads