Subject Re: [ib-support] Re: Stored Procedure bug
Author Gerhardus Geldenhuis
Marco Menardi wrote:
> I don't know it this will solve your proble, but use the correct
> syntax and try it inside delphi or whatever, not from QuickDesk or
> other tools like that (I had very strange behaviur today running a SP
> inside QuickDesk, while it worked perfectly from Delphi+Ibo... so
> strange...)
>

I fixed all the syntax, and I only refer to variables in sql statements
with a ":" All other variables are only referred to by their name now.

Unfortunately this had no effect. Before I posted the first message of
this thread I created a similar program in Delphi. The program in Delphi
worked first time. As far as my knowledge goes I have done everything
correctly. To me it appears as a bug of some sort in FB. I have tested
each statement in the sp seperately by writing the results to a temp
table. The problem lies here:

select workingday from workingdays
where sortorder = (select result from dayofweek_select(:In_Begin))
into :Temp;

select result from dayofweek_select(:In_Begin)into :tempint;

insert into temptable(descrip,val)values('TempValue',:Temp);
insert into temptable(descrip,val)values('subselect',:Tempint);

If you look at the value of "TempValue" in the table then it is always
'0'(Character) regardless. It should be '1'(Character) most of the
times. Replacing the where statement with "where sortorder = 4" or
"where sortorder = 7" returns a '0' and a '1' respectively.

The values of the subselect in the temptable is always the correct values.

Thus it appears that when you combine these statements it does not work
correctly any more.

I have found another solution to the problem(see previous posts) so
solving this is not critical. I realy don't think my code is wrong and
if it is'nt then it is a problem in fb.


Groete
Gerhardus