Subject | Re: [ib-support] Server configuration |
---|---|
Author | guido.klapperich@t-online.de |
Post date | 2001-10-04T20:51:25Z |
> IB was written for an age when computers were slow, memory was tiny and discHere it is:
> space hugely expensive. In most cases it can be made to perform adequately
> within those constraints. Of course, in an ideal world it would be able to use
> more memory and grind through to a solution more quickly. In the meantime, you
> just have to think the problem through a bit better. So, the bottom line is
> that your SP can be optimised to work better. Show us the code and we will see
> if it can be made to crank out the answer in a more timely manner.
CREATE PROCEDURE P_DOS_IMPORT_CUSTOMERS(
DELETEBEFOREINSERT SMALLINT)
RETURNS (
START_TIME TIME,
END_TIME TIME,
DURATION TIME)
AS
declare variable NAME1 VarChar(100);
declare variable NAME2 VarChar(100);
declare variable NAME3 VarChar(100);
declare variable DASTREET VarChar(100);
declare variable DAPOSTBOX VarChar(50);
declare variable DAPOSTBOXZIPCODE VarChar(50);
declare variable DAZIPCODE VarChar(50);
declare variable DACITY VarChar(50);
declare variable DADIALLINGCODE VarChar(50);
declare variable DATELEPHONE VarChar(50);
declare variable DAFAX VarChar(50);
declare variable CLASS VarChar(10);
declare variable SALES_REP VarChar(10);
declare variable REGION Varchar(100);
declare variable NRFIRST Integer;
declare variable NRLAST Integer;
declare variable INSTORE VarChar(100);
declare variable BRANCH VarChar(100);
declare variable CHANNEL VarChar(10);
declare variable OUTLET_NR VarChar(50);
declare variable GROUP_MAIN VarChar(100);
declare variable GROUP_SUB VarChar(100);
declare variable OUTLETS_A Numeric(10,4);
declare variable OUTLETS_B Numeric(10,4);
declare variable OUTLETS_C Numeric(10,4);
declare variable TURNOVER Numeric(15,2);
declare variable CLID Integer;
declare variable SAID Integer;
declare variable INID Integer;
declare variable BRID Integer;
declare variable CHID Integer;
declare variable GPID2 Integer;
declare variable GPID3 Integer;
begin
Start_Time='Now';
if (:DeleteBeforeInsert<>0) then
delete from CUSTOMERS;
for select NAME1,NAME2,NAME3,DASTREET,DAPOSTBOXZIPCODE,DAPOSTBOX,DAZIPCODE,
DACITY,DADIALLINGCODE,DATELEPHONE,DAFAX,CLASS,SALES_REP,REGION,NRFIRST,
NRLAST,INSTORE,BRANCH,CHANNEL,OUTLET_NR,GROUP_MAIN,GROUP_SUB,OUTLETS_A,
OUTLETS_B,OUTLETS_C,TURNOVER
from DOS_CUSTOMERS into :NAME1,:NAME2,:NAME3,:DASTREET,:DAPOSTBOXZIPCODE,
:DAPOSTBOX,:DAZIPCODE,:DACITY,:DADIALLINGCODE,:DATELEPHONE,:DAFAX,
:CLASS,:SALES_REP,:REGION,:NRFIRST,:NRLAST,:INSTORE,:BRANCH,:CHANNEL,
:OUTLET_NR,:GROUP_MAIN,:GROUP_SUB,:OUTLETS_A,:OUTLETS_B,:OUTLETS_C,:TURNOVER do
begin
if (:NRLAST>=0) then
begin
CLID=NULL;
select CL.CLID from CLASSES CL,DOS_CONSTANTS TMP where TMP.ID=21 and
TMP.SHORTCUT=:CLASS and TMP.NAME=CL.CLNAME into :CLID;
SAID=NULL;
select SA.SAID from SALESAREAS SA,DOS_CONSTANTS TMP where TMP.ID=3 and
TMP.SHORTCUT=:REGION and TMP.NAME=SA.SANAME into :SAID;
INID=NULL;
BRID=NULL;
select INID from INSTORES where INNAME=:INSTORE into :INID;
select BRID from BRANCHS where BRNAME=:BRANCH into :BRID;
CHID=NULL;
select CH.CHID from CHANNELS CH,DOS_CONSTANTS TMP where TMP.ID=5 and
TMP.SHORTCUT=:CHANNEL and TMP.NAME=CH.CHNAME into :CHID;
GPID2=NULL;
GPID3=NULL;
select GPID from GROUPS where GPNAME=:GROUP_MAIN into :GPID2;
select GPID from GROUPS where GPNAME=:GROUP_SUB into :GPID3;
insert into CUSTOMERS (CSDANAME1,CSDANAME2,CSDANAME3,CSDASTREET,CSDAZIPCODE,
CSDACITY,CSDAPOSTBOXZIPCODE,CSDAPOSTBOX,CSDADIALLINGCODE,CSDATELEPHONE,
CSDAFAX,CSCLID,CSSAID,CSNRFIRST,CSNRLAST,CSINID,CSBRID,CSCHID,CSBRANCHNR,
CSGPID2,CSGPID3,CSOUTLETA,CSOUTLETB,CSOUTLETC,CSTURNOVER) values
(:NAME1,:NAME2,:NAME3,:DASTREET,:DAZIPCODE,:DACITY,:DAPOSTBOXZIPCODE,
:DAPOSTBOX,:DADIALLINGCODE,:DATELEPHONE,:DAFAX,:CLID,:SAID,:NRFIRST,
:NRLAST,:INID,:BRID,:CHID,:OUTLET_NR,:GPID2,:GPID3,:OUTLETS_A,
:OUTLETS_B,:OUTLETS_C,:TURNOVER);
end
end
End_Time='Now';
Duration=cast('00.00.00' as time)+(End_Time-Start_Time);
suspend;
end