Subject | RE: [firebird-support] Date compare in firebird |
---|---|
Author | ibrahim bulut |
Post date | 2007-08-16T06:12:20Z |
Did you try to change string dates to parameters for this block
I have not tested but may be useful
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of redtneen
Sent: Wednesday, August 15, 2007 8:21 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Date compare in firebird
hi
i made this statement
execute block
returns (
"Account" integer,
"Debit" numeric(18,4),
"Credit" numeric(18,4),
"PriorBalance" numeric(18,4),
"Balance" numeric(18,4)
)
as
declare variable "aAcc" integer;
declare variable "ItmSite" integer;
declare variable "ItmDate" date;
declare variable "aDebit" numeric(18,4);
declare variable "aCredit" numeric(18,4);
begin
for
select "ItmSite", "ItmDate", "ItmAccount", "ItmLocalDebit",
"ItmLocalCredit"
from "VouItems"
where ("ItmAccount"=11)
into :"ItmSite", :"ItmDate", :"aAcc", :"aDebit", :"aCredit"
do
begin
if ( ("ItmDate" between '05/01/2006' and '06/30/2006') or
("ItmDate" between '08/01/2006' and '08/31/2006')) then
begin
--some calculations
end
if ( ("ItmDate"<='04/30/2006')) then
begin
--some calculations
end
end
end
i take about 8 seconds to execute about 800000 records
when i removed just if statement the time decrease to about 4 seconds
is there any way to speed up this code ????
notice: this code is made in run time so i don't know how many dates
i would comapre
my regards to u
__________ NOD32 2465 (20070816) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]
I have not tested but may be useful
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of redtneen
Sent: Wednesday, August 15, 2007 8:21 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Date compare in firebird
hi
i made this statement
execute block
returns (
"Account" integer,
"Debit" numeric(18,4),
"Credit" numeric(18,4),
"PriorBalance" numeric(18,4),
"Balance" numeric(18,4)
)
as
declare variable "aAcc" integer;
declare variable "ItmSite" integer;
declare variable "ItmDate" date;
declare variable "aDebit" numeric(18,4);
declare variable "aCredit" numeric(18,4);
begin
for
select "ItmSite", "ItmDate", "ItmAccount", "ItmLocalDebit",
"ItmLocalCredit"
from "VouItems"
where ("ItmAccount"=11)
into :"ItmSite", :"ItmDate", :"aAcc", :"aDebit", :"aCredit"
do
begin
if ( ("ItmDate" between '05/01/2006' and '06/30/2006') or
("ItmDate" between '08/01/2006' and '08/31/2006')) then
begin
--some calculations
end
if ( ("ItmDate"<='04/30/2006')) then
begin
--some calculations
end
end
end
i take about 8 seconds to execute about 800000 records
when i removed just if statement the time decrease to about 4 seconds
is there any way to speed up this code ????
notice: this code is made in run time so i don't know how many dates
i would comapre
my regards to u
__________ NOD32 2465 (20070816) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]