Subject help-Convert Sql Server to firebird
Author Farshid Dehghan
Please guide me how can I convert the following code.
Sql Server To firebird

CREATE PROCEDURE test

AS
BEGIN

declare @id int, @pay int,@cash int, @sum int
set @sum = 0
DECLARE sum_cursor Cursor
FOR SELECT id, Pay,Cash FROM T1 ORDER BY SD
OPEN sum_cursor
FETCH NEXT FROM sum_cursor
INTO @id, @pay,@cash
WHILE @@FETCH_STATUS= 0
BEGIN
select @sum = @sum + (@pay-@cash)
update T1 set RE = @sum where Id = @Id
FETCH NEXT FROM sum_cursor
INTO @id, @pay,@cash
END
CLOSE sum_cursor
DEALLOCATE sum_cursor
select*from T1 ORDER BY SD
END
GO