Hi i'm having trouble translating a stored procedure from ms sql to informix. It's a stored procedure used to deleted from a bunch of tables all related rows. The thing is I've never done stored procedure and i've been scratching my head with this one for a while here are the parts i can not translate

DECLARE crs1 CURSOR FOR
select code from contact
where campaign=@camp_code and code>=@from_code
and code <=@to_code

OPEN crs1
--raiserror ('open cursor error',1,1)

FETCH NEXT FROM crs1 INTO @easycode
if(@easycode=0)
begin
CLOSE crs1
DEALLOCATE crs1
raiserror('ERROR! No contact for deletion',1,1)
return -1
end

WHILE( @@fetch_status <> -1)

This is for the most part the thing i cannot translate, if you can help me on this i'd be more than greatfull. also if you know how i can put it on the server it would be fun

Thanks in advance

Kaarde