Subject Re: [IBO] Query not finishing before rest of program runs
Author Helen Borrie
At 05:30 PM 05-02-01 +0000, you wrote:
>Hello All
>I have a IBOquery like this.
>
>SELECT COUNT(Check_detail.CK_ID) Ck_id
> FROM CHECK_DETAIL Check_detail
> LEFT OUTER JOIN CHECK_MASTER Check_master
> ON Check_detail.CK_ID = Check_master.CK_ID
> WHERE (((Check_detail.CK_EMP_KEY = '003')
> AND (Check_detail.CD_RECORD_CODE = '4')
> AND (Check_detail.CK_RECORD_TOTAL_TYPE = 'C')
> AND (Check_master.CK_CK_DATE BETWEEN '02/01/2001'
>AND '02/28/2001')))
>
>
>What happens if I attach code to a button to open the query I get
>results. But if the query runs in a procedure that many other querys
>run then there are no results. It is as if it is not waiting to
>finish the query. If I attach code to a button to refresh the query
>after the procedure runs the data shows up. There are a lot of other
>querys and they all work fine. It seems that this perticular SQL
>syntax has a problem. I am using latest IBO update.


What are you doing inside your procedure to capture the result of the count
query? I would expect something like

create procedure Count_and_be_Damned
returns (Expensive_Row_Count integer) as
begin
SELECT COUNT(Check_detail.CK_ID) Ck_id
> FROM CHECK_DETAIL Check_detail
> LEFT OUTER JOIN CHECK_MASTER Check_master
> ON Check_detail.CK_ID = Check_master.CK_ID
> WHERE (((Check_detail.CK_EMP_KEY = '003')
> AND (Check_detail.CD_RECORD_CODE = '4')
> AND (Check_detail.CK_RECORD_TOTAL_TYPE = 'C')
> AND (Check_master.CK_CK_DATE BETWEEN '02/01/2001'
>AND '02/28/2001')))

into :Expensive_Row_Count;
Suspend;
END

Then your application call can be

SELECT Expensive_Row_Count from Count_and_be_Damned


Helen



All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________