Funds - Available Query For Po
Funds - Available Query For Po
The difference is, in the earlier query I have written 3 sub queries for budget, encumbrance, actual.
Now I created 3 functions like budget, encumbrance, actual and called in this query by passing the
period year and code combination id’s as parameters to this query, And also removed the gl balance
table in the new query, Rest everything is same.
Query
SELECT distinct
concatenated_segments,
project,
project_desc,
account,
account_desc,
nvl(budget, 0) budget,
nvl(encumbrance, 0) encumbrance,
nvl(actual, 0) actual,
FROM
SELECT distinct
code_combination_id,
concatenated_segments,
segment11 project,
segment4 account,
FROM
gl_code_combinations_kfv cc,
psa_je_bcp_lines_v v
WHERE
v.line_code_combination_id = cc.code_combination_id
AND cc.code_combination_id IN (
SELECT DISTINCT
gcc.code_combination_id
FROM
po_headers_all
pha, po_lines_all
pla, po_distributions_all
WHERE
pha.po_header_id = pla.po_header_id
WHERE
1 = 1;