SET TERM !! ;
EXECUTE BLOCK AS BEGIN
if (not exists(select 1 from rdb$indices where rdb$index_name = 'IDX_WGHSTO1')) then 
execute statement 'CREATE INDEX IDX_WGHSTO1 ON WGHSTO  (DATA);';
END!!
SET TERM ; !!

SET TERM !! ;
EXECUTE BLOCK AS BEGIN
if (not exists(select 1 from rdb$indices where rdb$index_name = 'IDX_WGHSTO2')) then 
execute statement 'CREATE INDEX IDX_WGHSTO2 ON WGHSTO  (CODICE);';
END!!
SET TERM ; !!

SET TERM !! ;
EXECUTE BLOCK AS BEGIN
if (not exists(select 1 from rdb$indices where rdb$index_name = 'IDX_WGHSTO3')) then 
execute statement 'CREATE INDEX IDX_WGHSTO3 ON WGHADDSTO  (CODCONTO);';
END!!
SET TERM ; !!

