Solution 1:

Based on your comments on the answer of Ain, it looks like you also want to return the selected values from the EXECUTE BLOCK. Your RETURNS (p) is invalid and will not work. You need to explicitly declare all columns you want to return, and you need to SUSPEND each row.

In addition you are also forgetting several statement terminators (;), and you can't declare the variable and its value together. The resulting execute block would be something like:

set term !!;
EXECUTE BLOCK returns (
    SOD_AUTO_KEY INTEGER,
    /* ... */
    HOT_PART VARCHAR(255)
) AS
    declare i integer;
BEGIN
    i = 0;
    while ( i <= 1000 ) do 
    BEGIN
       FOR SELECT SOD_AUTO_KEY, /* ... */ HOT_PART
           FROM SPB_SALESHISTORY(i) 
           INTO :SOD_AUTO, /* ... */ :HOT_PART
       DO
           SUSPEND;
       i = i + 1;
    end
END!!
SET TERM ;!!

I have left out some of the columns for brevity and guessed at their types.