I am during a select with a couple of decodes included. How can I use the result (tr.trans_type) from the first decode in function call (SUBSTANCES.get_desc) in the second decode statement.
SELECT TRANS_NUM,
sub.ACCOUNT,
TRANS_DATE,
DECODE( (trans_num is null AND tr.trans_type=6 AND item_code='C'), THEN 19
ELSE tr.trans_type
END) tr.trans_type,
DECODE (
show_first_desc,
'Y', description
|| ' '
|| SUBSTANCES.get_desc (trans_num, tr.trans_type),
DECODE (show_second, 'Y', description, NULL))
description
from transactions tr, substance sub
where transactions.account = substance.account;
getjbb
SELECT TRANS_NUM,
sub.ACCOUNT,
TRANS_DATE,
DECODE( (trans_num is null AND tr.trans_type=6 AND item_code='C'), THEN 19
ELSE tr.trans_type
END) tr.trans_type,
DECODE (
show_first_desc,
'Y', description
|| ' '
|| SUBSTANCES.get_desc (trans_num, tr.trans_type),
DECODE (show_second, 'Y', description, NULL))
description
from transactions tr, substance sub
where transactions.account = substance.account;
getjbb