Page 1 of 1

EXECUTE BLOCK With Parameters

Posted: Sun 02 Feb 2014 21:00
by jrodenhi
Is it possible to perform an EXECUTE BLOCK with parameters like

Code: Select all

execute block (smallest int = :Smallest, largest int = :Largest)
 returns (number int, square bigint, cube bigint, fourth bigint)
 as
 begin
    number = smallest;
    while (number <= largest) do
    begin
       square = number * number;
       cube = number * square;
       fourth = number * cube;
       suspend;
       number = number + 1;
    end
 end
and supply the parameters when the query is run?

Thanks for your help.

Jack Rodenhi

Re: EXECUTE BLOCK With Parameters

Posted: Mon 03 Feb 2014 15:19
by PavloP
Yes, you can use "EXECUTE BLOCK" with parameters. For example:

Code: Select all

  SimpleDataSet1.DataSet.CommandText := 'execute block (smallest int = :Smallest, largest int = :Largest) ...';
  SimpleDataSet1.DataSet.Params.ParamValues['Smallest'] := 2;
  SimpleDataSet1.DataSet.Params.ParamValues['Largest']  := 5;

Re: EXECUTE BLOCK With Parameters

Posted: Mon 03 Feb 2014 17:30
by jrodenhi
Thank you, Pavlo. I was not successful getting it to work with version 2.7. I will update to the latest and see if I can make it work there.

Thanks again for your help.

Jack

Re: EXECUTE BLOCK With Parameters

Posted: Mon 03 Feb 2014 18:22
by jrodenhi
I updated. It works fine.

Thanks again for your help.

Jack