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
Code: Select all
execute block (hTarget Integer = :hTarget)
returns (sLastName varchar(35))
as
begin
FOR SELECT e.sLastName
FROM PR_Employee e
WHERE e.hEmployer = hTarget
INTO sLastName
DO
suspend;
end
"Dynamic SQL Error
SQL error code = -206
Column unknown
HTARGET
At line 8, column 3."
It seems the error happens when you try to reference the block parameter within the code. If you put a colon on the HTARGET parameter within the block, the error changes to "invalid request BLR at offset 65 bad parameter number."
Is there a trick to doing this? Is it possible to use EXECUTE BLOCK like this?
Thank you in advance for any help.