select doc_no,date,acc_no,amount,
if xvar=1
(select acc_head from my_crem c where c.acc_no=o.acc_no) as acc_head
else
(select acc_head from my_debm c where c.acc_no=o.acc_no) as acc_head
from my_ordm o;
In the above query, xvar
is not a column name. It's a local variable name. Then how can I write the above query?