Tuesday, 4 February 2025

Oracle SQL Query to Analyze Journal Entries by Period

 Here is the sample query to retrieve the Journal entries/balance for a particular period. Please note this is a sample query. Modify accordingly as per your requirement.


SELECT 

  gl.PERIOD_NAME,

  gl.JOURNAL_CATEGORY_NAME,

  COUNT(*) as ENTRY_COUNT,

  SUM(gl.ENTERED_DR) as TOTAL_DEBIT,

  SUM(gl.ENTERED_CR) as TOTAL_CREDIT

FROM GL_JE_HEADERS gh,

     GL_JE_LINES gl 

WHERE gh.JE_HEADER_ID = gl.JE_HEADER_ID

AND gl.PERIOD_NAME = :P_PERIOD_NAME

GROUP BY gl.PERIOD_NAME, gl.JOURNAL_CATEGORY_NAME

ORDER BY gl.PERIOD_NAME;