Subject parameter not found
Author Ernesto Cullen
Hi all,
I have a problem I don't know how to deal with. I've a Delphi program
which calls a stored procedure in a Firebird Dialect 3 database (it's
included at the end of this message). The procedure goes as follows:

procedure TEstab.CalculaCaudalYRes(Sender: TField);
var
EnEdicion,Activa: Boolean;
begin
with spCalculosAbastAgua do
begin
ParamByName('elIDEstab').AsInteger:= IDEstab;
ParamByName('descRedBies').AsString:=
tabAbastAguaDSSIRVEREDBIES.AsString;
ParamByName('descEspuma').AsString:= tabAbastAguaDSSIRVEESPUMA.AsString;
ParamByName('descRociadores').AsString:=
tabAbastAguaDSSIRVEROCIADORES.AsString;
ParamByName('descAguaPul').AsString:=
tabAbastAguaDSSIRVEAGUAPUL.AsString;
ParamByName('descHidrantes').AsString:=
tabAbastAguaDSSIRVEAHIDRANTES.AsString;
ParamByName('descMonF').AsString:=
tabAbastAguaDSSIRVEAMONITORES.AsString;
ParamByName('IDAgua').AsInteger:= tabAbastAguaIDEXTINCIONAGUA.AsInteger;
ParamByName('DGCapacidad').AsFloat:= tabAbastAguaDGCAPACIDAD.AsFloat;
ExecProc;
Activa:= tabAbastAgua.Active;
tabAbastAgua.active:= true;
EnEdicion:= tabAbastAgua.State in dsEditModes;
if not EnEdicion then tabAbastAgua.Edit;
tabAbastAguaCAUDALTOTALREQU.AsFloat:= ParamByName('CaudalReq').AsFloat;
tabAbastAguaCAUDALTOTALREQUA.AsFloat:=
ParamByName('CaudalReqA').AsFloat;
tabAbastAguaRESERVAAGUADISP.AsFloat:=
ParamByName('ReservaDisp').AsFloat;
tabAbastAguaRESERVAAGUAREQU.AsFloat:= ParambyName('ReservaReq').AsFloat;
if not EnEdicion then tabAbastAgua.Post;
tabAbastAgua.Active:= Activa;
end;
end;

I have tried this many times in several machines at my office, all went ok.
But in a couple of cases, both in a different user's installations, it says

spCalculosAbastAgua: parameter `descHidrantes´ not found

Only when running in a specific machine, let's call it 'wrong machine'.

I'm using IBX. The application is installed via a custom installer made with
InstallShield Express, using the firebird 1 merge modules from
www.mwasoftware.co.uk. The application is running ok on a different machine
('ok machine'), but if the app runs in the 'wrong machine', either as client
only or as a local server, it shows the error. Both ok and wrong machines
are running Win 2000.

Does anybody has a clue? Does Firebird 1 has any known problem with a
particular processor or hardware configuration?


Ernesto Cullen
Argentina



CREATE PROCEDURE SPCALCULOSABASTAGUA (ELIDESTAB INTEGER,
DESCREDBIES CHAR(1),
DESCESPUMA CHAR(1),
DESCROCIADORES CHAR(1),
DESCAGUAPUL CHAR(1),
DESCHIDRANTES CHAR(1),
DESCMONF CHAR(1),
IDAGUA INTEGER,
DGCAPACIDAD NUMERIC(18,6))
returns (CAUDALREQ NUMERIC(18,6),
RESERVADISP NUMERIC(18,6),
RESERVAREQ NUMERIC(18,6),
CAUDALREQA NUMERIC(18,6))
AS
declare variable temp numeric(18,6);
declare variable temp2 numeric(18,6);
declare variable temp3 numeric(18,6);
begin
/*
calcula los valores de caudal y reserva requerido y disponible para un
abast.
de agua. Considera TODOS los sistemas marcados como 'de descarga
simultanea',
que a este sp llegan como parámetros. Es decir: no se usa el parametro de
entrada
'IDAgua', que identifica al abastecimiento de agua, por ahora. Lo dejo
porque
SEGURO que despues querrán que identifiquemos los sistemas que se conectan
a
cada abastecimiento...
*/
CaudalReq = 0;
CaudalReqA = 0;
ReservaReq = 0;

if (descRedBies='T') then
begin
select max(ReqCaudal),max(ReqPresion),max(ReqReserva)
from seRedBies
where IDEstab=:elIDEstab
into :temp,:temp2,:temp3;

if (temp is not null) then
CaudalReq = CaudalReq+temp;

if (temp2 is not null) then
if (temp2>CaudalReqA) then
CaudalReqA = temp2;

if (temp3 is not null) then
ReservaReq = ReservaReq+temp3;
end

if (descEspuma='T') then
begin
select max(ReqCaudal),max(ReqPresion),max(ReqReserva)
from seEspuma
where IDEstab=:elIDEstab
into :temp,:temp2,:temp3;

if (temp is not null) then
CaudalReq = CaudalReq+temp;

if (temp2 is not null) then
if (temp2>CaudalReqA) then
CaudalReqA = temp2;

if (temp3 is not null) then
ReservaReq = ReservaReq+temp3;
end

if (descRociadores='T') then
begin
select max(ReqCaudal),max(ReqPresion),max(ReqReserva)
from seRociadores
where IDEstab=:elIDEstab
into :temp,:temp2,:temp3;

if (temp is not null) then
CaudalReq = CaudalReq+temp;

if (temp2 is not null) then
if (temp2>CaudalReqA) then
CaudalReqA = temp2;

if (temp3 is not null) then
ReservaReq = reservaReq+temp3;
end

if (descAguaPul='T') then
begin
select max(ReqCaudal),max(reqPresion),max(ReqReserva)
from seAguaPulverizada
where IDEstab=:elIDEstab
into :temp,:temp2,:temp3;

if (temp is not null) then
CaudalReq = CaudalReq+temp;

if (temp2 is not null) then
if (temp2>CaudalReqA) then
CaudalReqA = temp2;

if (temp3 is not null) then
ReservaReq = reservaReq+temp3;
end

if (DescHidrantes = 'T') then
begin
select max(CaudalChe)*16.66666667, /* está en m3/h, lo paso a l/min como
todos los demas */
max(ReqPresion),max(ReqAutonomia)
from seRedGeneral
where IDEstab = :elIDESTAB
into :temp,:temp2,:temp3;

if (temp is not null) then
CaudalReq = CaudalReq+temp;

if (temp2 is not null) then
if (temp2>CaudalReqA) then
CaudalReqA = temp2;

if (temp3 is not null) then
ReservaReq = ReservaReq+temp*temp3*0.001;
end

if (DescMonF = 'T') then
begin
select max(CaudalMonitores)*16.66666667, /* está en m3/h, lo paso a l/min
como todos los demas */
max(ReqPresion),max(ReqAutonomia)
from seRedGeneral
where IDEstab = :elIDESTAB
into :temp,:temp2,:temp3;

if (temp is not null) then
CaudalReq = CaudalReq+temp;

if (temp2 is not null) then
if (temp2>CaudalReqA) then
CaudalReqA = temp2;

if (temp3 is not null) then
ReservaReq = ReservaReq+temp*temp3*0.001;
end

select sum(Capacidad)
from Depositos
where IDExtincionAgua = :IDAgua
into :temp;

if (DGCapacidad is not null) then
ReservaDisp = DGCapacidad;
else
ReservaDisp = 0;

if (temp is not null) then
ReservaDisp = ReservaDisp+temp;


CaudalReq = CaudalReq * 0.06; /* convierte a m3/h */
CaudalReqA = CaudalReqA * 10; /* convierte a m.c.a. */
end