I am working with informix 10 and have been facing an issue while using multiple for each in a procedure. It works when i have just the first for each and the following for eachs does not seem to work.

Ex:
CREATE PROCEDURE test_1()

BEGIN

/*
'Started working on Entities of type - network element, shelf, card, port,central office'
*/
FOREACH SELECT e.entity_id
INTO ent_id
FROM entity e
where substr(e.hier_name,5,2) in ('CA')
and e.hier_name not in ('BGRVCAXFRLO','BGRVCAXFRS1','BLYTCABARL0','BLYTCA XF92K','BLYTCAXGRS1','BLYTCAXHRL1','CEVLCAXFRS6',
'HVSUCAXFRS1','PYVLCAAARL0','WDFRCAAARL0','WDFRCAX FRS1','PLVRCAXFRS1')


/*Delete the attributes of the entity*/
delete from ent_attr
where entity_id = ent_id;



/*Delete the alias of the entity*/
delete from entity_alias
where entity_id = ent_id;



/*Delete the entity from entity_relations*/
delete from entity_relations
where entity_id = ent_id;

delete from entity_relations
where rel_ent_id = ent_id;



/*Delete the entity*/

delete from entity
where entity_id = ent_id;


END FOREACH;
/*
'Completed working on Entities of type - network element, shelf, card, port,central office'
*/

/*
'Started working on Entities of type - circuit, channel' ;
*/

FOREACH SELECT e.entity_id
INTO ent_id
FROM entity e
where substr(e.hier_name,18,2) in ('CA')
and e.hier_name not in ('BGRVCAXFRLO','BGRVCAXFRS1','BLYTCABARL0','BLYTCA XF92K','BLYTCAXGRS1','BLYTCAXHRL1','CEVLCAXFRS6',
'HVSUCAXFRS1','PYVLCAAARL0','WDFRCAAARL0','WDFRCAX FRS1','PLVRCAXFRS1')


/*Delete the attributes of the entity*/
delete from ent_attr
where entity_id = ent_id;



/*Delete the alias of the entity*/
delete from entity_alias
where entity_id = ent_id;



/*Delete the entity from entity_relations*/
delete from entity_relations
where entity_id = ent_id;

delete from entity_relations
where rel_ent_id = ent_id;



/*Delete the entity*/
delete from entity
where entity_id = ent_id;



END FOREACH;

FOREACH SELECT e.entity_id
INTO ent_id
FROM entity e
where substr(e.hier_name,30,2) in ('CA')
and e.hier_name not in ('BGRVCAXFRLO','BGRVCAXFRS1','BLYTCABARL0','BLYTCA XF92K','BLYTCAXGRS1','BLYTCAXHRL1','CEVLCAXFRS6',
'HVSUCAXFRS1','PYVLCAAARL0','WDFRCAAARL0','WDFRCAX FRS1','PLVRCAXFRS1')


/*Delete the attributes of the entity*/
delete from ent_attr
where entity_id = ent_id;



/*Delete the alias of the entity*/
delete from entity_alias
where entity_id = ent_id;



/*Delete the entity from entity_relations*/
delete from entity_relations
where entity_id = ent_id;

delete from entity_relations
where rel_ent_id = ent_id;



/*Delete the entity*/
delete from entity
where entity_id = ent_id;



END FOREACH;
/*
'Completed working on Entities of type - circuit, channel' ;
*/

/*
'Started working on Entities of type - network'
*/
FOREACH SELECT e.entity_id
INTO ent_id
FROM entity e
where substr(e.hier_name,1,2) in ('CA')
and e.hier_name not in ('BGRVCAXFRLO','BGRVCAXFRS1','BLYTCABARL0','BLYTCA XF92K','BLYTCAXGRS1','BLYTCAXHRL1','CEVLCAXFRS6',
'HVSUCAXFRS1','PYVLCAAARL0','WDFRCAAARL0','WDFRCAX FRS1','PLVRCAXFRS1')


/*Delete the attributes of the entity*/
delete from ent_attr
where entity_id = ent_id;



/*Delete the alias of the entity*/
delete from entity_alias
where entity_id = ent_id;



/*Delete the entity from entity_relations*/
delete from entity_relations
where entity_id = ent_id;

delete from entity_relations
where rel_ent_id = ent_id;



/*Delete the entity*/
delete from entity
where entity_id = ent_id;



END FOREACH;

/*
'Completed working on Entities of type - network'
*/
END;
END PROCEDURE;


Your help is really appreciated
Thanks in advance