https://aporaclepayables.blogspot.com/2019/12/bank-bank-account-cheque-book-plsql.html
select a.bank_name,b.BANK_ACCOUNT_NAME, b.BANK_ACCOUNT_NUM, b.CURRENCY_CODE, b.IBAN_NUMBER, b.EFT_USER_NUM,
c.SEGMENT1, c.SEGMENT9 , c.SEGMENT10, c.SEGMENT2, c.SEGMENT3, c.SEGMENT4, c.SEGMENT5, c.SEGMENT6,c.SEGMENT7,c.SEGMENT8, c.SEGMENT11
,
(SELECT gl_flexfields_pkg.get_description_sql
(
50232388,--- chart of account id
5,----- Position of segment
segment3 ---- Segment value
)
FROM gl_code_combinations g where g.CODE_COMBINATION_ID = c.CODE_COMBINATION_ID ) Description
,d.PAYMENT_DOCUMENT_NAME , d.PAPER_STOCK_TYPE , d.FIRST_AVAILABLE_DOCUMENT_NUM
from ce_banks_v a, ce_bank_accounts b , gl_code_combinations c ,ce_payment_documents d
where a.bank_party_id = b.BANK_ID
and b.ASSET_CODE_COMBINATION_ID = c.CODE_COMBINATION_ID
and b.BANK_ACCOUNT_ID = d.INTERNAL_BANK_ACCOUNT_ID
--and trunc(b.CREATION_DATE) = '13-DEC-2019'
--order by c.SEGMENT3 asc