Query to find general ledger PTD,YTD Account balance in Oracle APPS
SELECT glb.SET_OF_BOOKS_ID,glb.CURRENCY_CODE,
glb.PERIOD_NAME,
glb.period_year,
glb.BEGIN_BALANCE_CR,
glb.BEGIN_BALANCE_DR,
gcc.segment1
||'.'
||gcc.segment2
||'.'
||gcc.segment3
||'.'
||gcc.segment4
||'.'
||gcc.segment5
||'.'
||gcc.segment6
||'.'
||gcc.segment7,
(glb.period_net_dr - glb.period_net_cr) PTD,
(NVL (glb.BEGIN_BALANCE_DR, 0) - NVL (glb.BEGIN_BALANCE_CR, 0)) + (NVL (glb.PERIOD_NET_DR, 0) - NVL (glb.PERIOD_NET_CR, 0)) YTD
FROM apps.gl_balances glb,
apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = glb.code_combination_id
AND glb.actual_flag = 'A'
AND glb.period_name = 'JAN-19';
AND glb.code_combination_id = 1739;