Basta usar
NOT IN
para encontrar os registros sem correspondência com new_table g
, e reúna com os registros recuperados por INNER JOIN
SELECT f.id_hist, f.producto, f.price
FROM TABLE(fnc_historical('JAP')) f
WHERE f.id_hist NOT IN
(SELECT DISTINCT f.id_hist
FROM TABLE(fnc_historical('JAP')) f
inner join new_table g on (f.id_new = g.id_hist)
)
UNION
SELECT f.id_hist, f.producto, g.new_price
FROM TABLE(fnc_historical('JAP')) f
inner join new_table g on (f.id_new = g.id_hist)