SELECT hou.organization_id
, hou.name organization_name
, iop.organization_code organization_code
, lgr.ledger_id set_of_book_id
, lgr.chart_of_accounts_id chart_of_account_id
, lgr.currency_code
, lgr.period_set_name
, Decode(hoi.status, 'A', 'Y', 'N') inv_enabled_flag
, bu.bu_name business_unit_name
, iop.business_unit_id business_unit_id
, iop.legal_entity_id legal_entity
, hou.type organization_type
FROM hr_all_organization_units_x hou
, hr_org_unit_classifications_x hoi
, inv_org_parameters iop
, gl_ledgers lgr
, fun_all_business_units_v bu
WHERE hou.organization_id = hoi.organization_id
AND hou.organization_id = iop.organization_id
AND hoi.classification_code = 'INV'
AND bu.primary_ledger_id = lgr.ledger_id(+)
AND lgr.object_type_code(+) = 'L'
AND NVL(lgr.complete_flag, 'Y') = 'Y'
AND bu.bu_id(+) = iop.business_unit_id;
SQL : Get Business Unit Details
===================================
SELECT hauft.NAME BusinessUnit, hauft.organization_id
FROM hr_org_unit_classifications_f houcf,
hr_all_organization_units_f haouf,
hr_organization_units_f_tl hauft
WHERE haouf.organization_id = houcf.organization_id
AND haouf.organization_id = hauft.organization_id
AND haouf.effective_start_date BETWEEN houcf.effective_start_date AND houcf.effective_end_date
AND hauft.language = 'US'
AND hauft.effective_start_date = haouf.effective_start_date
AND hauft.effective_end_date = haouf.effective_end_date
AND houcf.classification_code = 'FUN_BUSINESS_UNIT'
AND sysdate BETWEEN hauft.effective_start_date AND hauft.effective_end_date
ORDER BY hauft.NAME ASC nulls first ;
SQL : Get Costing Organization Details
===================================
SELECT hauft.NAME BusinessUnit
FROM hr_org_unit_classifications_f houcf,
hr_all_organization_units_f haouf,
hr_organization_units_f_tl hauft
WHERE haouf.organization_id = houcf.organization_id
AND haouf.organization_id = hauft.organization_id
AND haouf.effective_start_date BETWEEN houcf.effective_start_date AND houcf.effective_end_date
AND hauft.language = 'US'
AND hauft.effective_start_date = haouf.effective_start_date
AND hauft.effective_end_date = haouf.effective_end_date
AND houcf.classification_code = 'CST'
AND sysdate BETWEEN hauft.effective_start_date AND hauft.effective_end_date
ORDER BY hauft.NAME ASC nulls first;