I tried to create a stored proc at runtime with an TZSQLProcessor component which has its DelimiterType set to dtSetTerm but when I execute the script I had this message :
Invalid Request BLR at at offset 208 invalid parameter number
SET TERM ^ ;
CREATE PROCEDURE GET_TOTAL (
ID_FNM INTEGER,
CR_DATE DATE)
RETURNS (
TOT_BP DECIMAL(15,2),
TOT_BS DECIMAL(15,2),
TOT_VIR_D DECIMAL(15,2),
TOT_VIR_E DECIMAL(15,2))
AS
begin
/* BP */
select sum(MT_BP) - SUM(MT_REGIE) from FNM
where Id_FNM=:Id_FNm and date_bp <=:cr_date
into tot_bp;
/* BS */
select sum(MT_BS) from FNM
where Id_FNM=:Id_FNm and date_bs <=:cr_date
into tot_bs;
/* VIR D */
select sum(MONTANT) from virement
where Sens='D' and Id_FNM=:Id_FNm and date_vir <=:cr_date
into tot_vir_D;
/* VIR E */
select sum(MONTANT) from virement
where Sens='E' and Id_FNM=:Id_FNm and date_vir <=:cr_date
into tot_vir_E;
suspend;
end^
SET TERM ; ^
In the link, ExecuteDirect is used with mySql. With firebird, 'properties' is used for the work. Perhaps this statement does'nt work with firebird.
Is there any one to confirm or not .
akli_agha,
No, you have to put your sql in the ExecuteDirect('string'), not in the 'properties'. It is implemented as a executeUpdate statement, returning an integer representing the number of affected rows.
guido
ExecuteDirect is a method of a TZConnection component. It's a shortcut to avoid working with TZQuery components when you just want to send a query to the server that doesn't need a resultset.
When you have a valid database connection you can do
myconnection.ExecuteDirect('Insert into logs(time) values ("2001-12-01 23:35:59")');