Subject | Re: [ib-support] SQL Question |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-06-05T15:15:51Z |
Hi Robert!
existence of a record within it.
what it contains. Using
WHERE (EXISTS (SELECT 'Norwegian humour' FROM MEMPAY2 M2
would work equally well - just consuming slightly more resources.
single row in your table satisfying your criteria (including those where
your subselect returned null) and that such an error would have been easier
to spot in a SP.
Set
>Why does this need two instances of Mempay2?Because you're a) updating it and b) using a subselect do determine the
existence of a record within it.
>What does SELECT 1 mean at <--- below?Nothing - you're just interested in there being a record and don't care
> WHERE (EXISTS (SELECT 1 FROM MEMPAY2 M2 <---
what it contains. Using
WHERE (EXISTS (SELECT 'Norwegian humour' FROM MEMPAY2 M2
would work equally well - just consuming slightly more resources.
>Why is an SP, "the safe route"?Probably because the way you originally wrote your query updated every
single row in your table satisfying your criteria (including those where
your subselect returned null) and that such an error would have been easier
to spot in a SP.
Set