EXECUTE BLOCK With Parameters

EXECUTE BLOCK With Parameters

Postby jrodenhi » Sun 02 Feb 2014 21:00

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
jrodenhi
 
Posts: 9
Joined: Thu 18 Feb 2010 23:17

Re: EXECUTE BLOCK With Parameters

Postby PavloP » Mon 03 Feb 2014 15:19

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;
PavloP
Devart Team
 
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: EXECUTE BLOCK With Parameters

Postby jrodenhi » Mon 03 Feb 2014 17:30

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
jrodenhi
 
Posts: 9
Joined: Thu 18 Feb 2010 23:17

Re: EXECUTE BLOCK With Parameters

Postby jrodenhi » Mon 03 Feb 2014 18:22

I updated. It works fine.

Thanks again for your help.

Jack
jrodenhi
 
Posts: 9
Joined: Thu 18 Feb 2010 23:17


Return to dbExpress driver for InterBase & Firebird