Here a quick example of how NVL and CASE can be switched to improve performance and readability.
-- CASE VERSION with X097_TEMP_EDIT_TO_DNI_TRANSACT
SELECT
( CASE WHEN x097.c097_edit_name IS NULL THEN t097.c097_edit_name ELSE x097.equip_stn_no END
) as c097_edit_name,
t097.c097_edit_name as tempHistoric, x097.equip_stn_no
FROM t097_temp_edit_his t097, X097_TEMP_EDIT_TO_DNI_TRANSACT x097, CIRCUIT
where t097.c097_edit_name =x097.c097_edit_name (+)
AND 6100006 = circuit.circt_id (+)
and rownum < 10;
-- NVL VERSION with X097_TEMP_EDIT_TO_DNI_TRANSACT
SELECT NVL(x097.equip_stn_no , t097.c097_edit_name ) as c097_edit_name,
x097.equip_stn_no END ) as c097_edit_name,
t097.c097_edit_name as tempHistoric, x097.equip_stn_no
FROM t097_temp_edit_his t097, X097_TEMP_EDIT_TO_DNI_TRANSACT x097, CIRCUIT
where t097.c097_edit_name =x097.c097_edit_name (+)
AND 6100006 = circuit.circt_id (+)
and rownum < 10;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment