Subject using union in a subquery within an IN condition does not work in FB 1.5.5 ?
Author Carlos A. Caballero Yunis
hi all. (sorry for my bad english)

1) this SP, does not compile only when using UNION.

for select p.id_producto, p.descripcion
from productos p
where p.id_familia_producto like :id_familia_producto_p
and p.id_producto like :id_producto_p
and p.id_producto in
(
select distinct(df.id_producto)
from facturaciones f, detalle_facturaciones df
where f.id_factura = df.id_factura
and f.fecha_documento between :fecha_inicio_l and :fecha_fin_l
and f.id_campanha_x_rubro_agricola = :id_campanha_x_rubro_agricola_l
and f.id_zona like :id_zona_p
and f.id_empleado like :id_empleado_p
and f.id_cliente like :id_cliente_p
UNION /* this union, Parsing Error*/
select distinct(dnc.id_producto)
from notas_creditos nc, detalle_notas_creditos dnc
where nc.id_nota_credito = dnc.id_nota_credito
and nc.fecha between :fecha_inicio_l and :fecha_fin_l
and nc.id_campanha_x_rubro_agricola = :id_campanha_x_rubro_agricola_l
and nc.id_zona like :id_zona_p
and nc.id_empleado like :id_empleado_p
and nc.id_cliente like :id_cliente_p
)
into :id_producto_l, :detalle
do begin
...
end


2) but this UNION, works fine:

select distinct(df.id_producto)
from facturaciones f, detalle_facturaciones df
where f.id_factura = df.id_factura
and f.fecha_documento between :fecha_inicio_l and :fecha_fin_l
and f.id_campanha_x_rubro_agricola = :id_campanha_x_rubro_agricola_l
and f.id_zona like :id_zona_p
and f.id_empleado like :id_empleado_p
and f.id_cliente like :id_cliente_p
UNION
select distinct(dnc.id_producto)
from notas_creditos nc, detalle_notas_creditos dnc
where nc.id_nota_credito = dnc.id_nota_credito
and nc.fecha between :fecha_inicio_l and :fecha_fin_l
and nc.id_campanha_x_rubro_agricola = :id_campanha_x_rubro_agricola_l
and nc.id_zona like :id_zona_p
and nc.id_empleado like :id_empleado_p
and nc.id_cliente like :id_cliente_p
------

using union in a subquery within an IN condition does not work in FB 1.5.5 ?

--
Best Regards.
Carlos Caballero.