Subject | Re: [ib-support] Re: SQL ORDER BY problem |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2002-07-25T13:01:08Z |
On 25 Jul 2002 at 10:47, csswa wrote:
Counter = 0;
For select c1,c2 from TableA where c1=x and c2=y into :c1, :c2 do
begin
Counter = Counter+1;
suspend;
end;
If (Counter=0) then
For select c1,c2 from TableA where c1=x into :c1,:c2 do
suspend;
It is one select shorter and should work a bit faster.
SY, Dimitry Sibiryakov.
>It walks the data until it finds a match (it needs only one), at whichI'd suggest a slightly different solution:
>point the EXISTS condition becomes true so it exits to do the
>first-case select. If it walks the entire db without finding a first-
>case match then it does the second-case select. EXISTS is my
>favourite keyword :-)
Counter = 0;
For select c1,c2 from TableA where c1=x and c2=y into :c1, :c2 do
begin
Counter = Counter+1;
suspend;
end;
If (Counter=0) then
For select c1,c2 from TableA where c1=x into :c1,:c2 do
suspend;
It is one select shorter and should work a bit faster.
SY, Dimitry Sibiryakov.