I have an Interbase query in an SP that looks a little like this:

for
  select 1
  from   product
  where  plu = :plu and
         (description <> :description or supplierid <> :supplierid
          etc etc)
do
begin
  update product
  blah blah

end



Now the problem is that I have some date fields that can be null so in teh 
comparision if I use then, the whole select fails bacause any null will set 
the whole expression to null.  So to compare a null date I would have to do 
this:

for
  select 1
  from   product
  where  plu = :plu and
         (description <> :description or supplierid <> :supplierid or
          (adddate is null and :adddate is null) or
          (adddate is not null and :adddate is null) or
          (adddate is null and :adddate is not null) or
          (adddate <> :adddate)
do

Given that I have several nullable field in some tables, this could get 
rather icky.

In MS SQL there is an IsNull function that is used to set defaults.  So the 
above would become:

for
  select 1
  from   product
  where  plu = :plu and
         (description <> :description or supplierid <> :supplierid or
          isnull(adddate) <> isnull(:adddate))
do

But there is no IsNull function in IB.

Has anyone got a solution for this?

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to