No sé si lo siguiente es correcto y si realmente es eficiente en cuanto a tiempo de ejecución frente a otras posibilidades :
Código SQL
[-]Select TA.CampoA1, TA.CampoA2,
case when TB.Min_CampoB1 = 1 then ..... else .... end as Resultado1,
case when TB.Min_CampoB1 = 2 then ..... else .... end as Resultado2,
case when TB.Min_CampoB1 = 3 then ..... else .... end as Resultado3
from TABLA_A TA
left join SP_PRUEBA(TA.CLAVE1) TB
on TA.CLAVE1 = TA.CLAVE1
... pero me permite utilizar TB.Min_CampoB1 como 'valor' en toda la consulta.
El Stored Procedure SP_PRUEBA se podría definir como :
Código SQL
[-]CREATE OR ALTER PROCEDURE SP_PRUEBA (
in_Clave1 integer)
returns (
Min_CampoB1 integer)
as
begin
Select Min(CampoB1) from TABLA_B
where Clave1 = :In_Clave1
into Min_CampoB1;
suspend;
end