SELECT a.name "Operating Unit",
(select name from v$database) DBNAME,
(select sysdate from dual) Extract_Date,
DECODE (WHEN_TO_ACCOUNT_PMT, 'ALWAYS', 'Yes') "When Payment is Issued",
DECODE (WHEN_TO_ACCOUNT_GAIN_LOSS, 'ALWAYS', 'Yes')
"Account for Gain/Lost",
DECODE (FUTURE_DATED_PMT_ACCT_SOURCE, 'BANK ACCOUNT', 'Yes')
"From Payment Document",
LIABILITY_POST_LOOKUP_CODE "None",
DISCOUNT_DISTRIBUTION_METHOD "Discount SystemAccount",
PRORATE_INT_INV_ACROSS_DISTS "Interest SystemAccount",
BUILD_PREPAYMENT_ACCOUNTS_FLAG "From Supplier Site",
DECODE (MULTI_CURRENCY_FLAG, 'Y', 'Yes', 'N', 'No')
"Use Multiple Currencies",
(SELECT segment1
|| '-'
|| segment2
|| '-'
|| segment3
|| '-'
|| segment4
|| '-'
|| segment5
|| '-'
|| segment6
FROM apps.gl_code_combinations
WHERE code_combination_id = b.GAIN_CODE_COMBINATION_ID) "Realized Gain",
(SELECT segment1
|| '-'
|| segment2
|| '-'
|| segment3
|| '-'
|| segment4
|| '-'
|| segment5
|| '-'
|| segment6
FROM apps.gl_code_combinations
WHERE code_combination_id = b.LOSS_CODE_COMBINATION_ID)
"Realized Loss",
(SELECT segment1
|| '-'
|| segment2
|| '-'
|| segment3
|| '-'
|| segment4
|| '-'
|| segment5
|| '-'
|| segment6
FROM apps.gl_code_combinations
WHERE code_combination_id = b.ROUNDING_ERROR_CCID) "Rounding",
DECODE (CONFIRM_DATE_AS_INV_NUM_FLAG, 'Y', 'Yes', 'N', 'No') "Confirm Date as Invoice Number",
DECODE (APPROVALS_OPTION, 'Y', 'Yes', 'N', 'No') "Allow Online Validation",
DECODE (GL_DATE_FROM_RECEIPT_FLAG, 'I', 'Yes') "Invoice Date",
DECODE (CREATE_EMPLOYEE_VENDOR_FLAG, 'Y', 'Yes', 'N', 'No')
"CreateEmployeeasSupplier",
DECODE (CREATE_AWT_DISTS_TYPE, 'NEVER', 'Yes')
"Apply Withholding TaxNever",
DECODE (CREATE_AWT_INVOICES_TYPE, 'NEVER', 'Yes')
"CreateWithholdingInvoiceNever",
WITHHOLDING_DATE_BASIS "Invoice Date",
TERMS_DATE_BASIS "Term Date Basis"
FROM apps.hr_operating_units a, apps.AP_SYSTEM_PARAMETERS_ALL b
WHERE a.ORGANIZATION_ID = b.org_id
ORDER BY a.name