Just as you would in an output link derivation...the rules are the same.
Every "if" requires both a "then" and an "else" to be present. In your code, you have no else statement to describe what to do when lnk_xfmr.DIR is not equal to either 'IN' or 'OUT'.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
if lnk_lkp_filter_table_xfmr.C_ACH_DIR = 'IN' then lnk_lkp_filter_table_xfmr.N_AC2
else lnk_lkp_filter_table_xfmr.C_ACH_DIR = 'OUT' then lnk_lkp_filter_table_xfmr.N_AC1
else setNULL()
There ya go! The column itself may only ever have "IN" and "OUT" as values, but in your logic you need to account for the possibility. If you absolutely, positively know that "IN" and "OUT" are all you will ever see, then the following type of logic could be valid, but wouldn't catch situations where the data is invalid:
if lnk_lkp_filter_table_xfmr.C_ACH_DIR = 'IN' then lnk_lkp_filter_table_xfmr.N_AC2
else lnk_lkp_filter_table_xfmr.C_ACH_DIR = 'OUT' then lnk_lkp_filter_table_xfmr.N_AC1
else setNULL()