Monday 26 October 2015

Query to find Bank, Bank Account and Bank Branches Information


SELECT hou.name Operating_Unit,
       cbb.bank_name,
       cbb.BANK_NUMBER,
       cba.bank_account_num,
       cba.bank_account_name,
       cba.account_classification,
       cbb.bank_branch_number Routing_NUmber,
       cbb.bank_branch_name,
       cbb.bank_branch_type,
       cba.multi_currency_allowed_flag,
       cba.zero_amount_allowed,
       cbb.eft_swift_code BIC_Code,
       gcf.concatenated_segments
  FROM ce_bank_accounts cba,
       ce_bank_acct_uses_all cbau,
       cefv_bank_branches cbb,
       hr_operating_units hou,
       gl_code_combinations_kfv gcf
 WHERE     1 = 1
       AND cba.bank_account_id = cbau.bank_account_id
       AND cba.bank_branch_id = cbb.bank_branch_id
       AND hou.organization_id = cbau.org_id
       AND cba.asset_code_combination_id = gcf.code_combination_id
       AND (cba.end_date IS NULL OR cba.end_date >= TRUNC (SYSDATE))
       AND (hou.business_group_id = :P_BG_ID OR :P_BG_ID IS NULL)