このselectをcaseステートメントで実行すると、上記のエラーが発生しました。いくつかの方法を試しましたが、構文を正しく取得できません。
SELECT m.md_security_id,
thv.unit_qty,
thv.contract_value_amt,
thv.contract_currency_cd,
(case when
THV.BORROW_LOAN_TYPE_CD = 'B'
then select THV.SENDER_ORG_ID as BORROWER_ORG_ID,
select THV.RECIPIENT_ORG_ID as LENDER_ORG_ID
end),
(case when
THV.BORROW_LOAN_TYPE_CD = 'L'
THEN select THV.RECIPIENT_ORG_ID as BORROWER_ORG_ID,
select THV.SENDER_ORG_ID as LENDER_ORG_ID
end)
FROM eqmddev.txn_header_mv thv,
eqmddev.md_security m,
eqmddev.security_xref_vw_tbl x
WHERE m.isin = x.security_id
AND ThV.SECURITY_MASTER_ID = X.SECURITY_MASTER_ID
AND M.EXCHANGE_CD = X.EXCHANGE_CD