Monday, January 4, 2021

Query to find Trial Balance Details in Oracle

This query will help you to find details of trial balance.

 

 

/*Query to find Trial Balance Details in Oracle*/


  SELECT gjh.name Journal_name,
         gjh.period_name,
         GL.name,
         gjh.je_category category_name,
         gjh.je_source source_name,
         gjb.name batch_name,
         GCC.SEGMENT1,
         GCC.SEGMENT2,
         GCC.SEGMENT3,
         GCC.SEGMENT4,
         GCC.SEGMENT5,
         GCC.SEGMENT6,
         SUM (NVL (GJL.ACCOUNTED_DR, 0)) ACCOUNTED_DR,
         SUM (NVL (GJL.ACCOUNTED_CR, 0)) ACCOUNTED_CR,
         SUM (NVL (GJL.ACCOUNTED_DR, 0) - NVL (GJL.ACCOUNTED_CR, 0)) BALANCE
    FROM gl_je_headers gjh,
         gl_je_lines gjl,
         gl_ledgers gl,
         gl_code_combinations gcc,
         GL_JE_BATCHES GJB
   WHERE     gjl.je_header_id = gjh.je_header_id
         AND gjh.je_batch_id = gjb.je_batch_id
         AND gjl.code_combination_id = gcc.code_combination_id
         AND gjh.ledger_id = gl.ledger_id
         AND gjh.status = 'P'
         AND gjh.actual_flag = 'A'
         AND gjh.period_name = :P_Period_Name
         AND GL.LEDGER_ID = :P_Ledger
         AND GCC.SEGMENT4 = :P_GL_Code
GROUP BY GCC.SEGMENT1,
         GCC.SEGMENT2,
         GCC.SEGMENT3,
         GCC.SEGMENT4,
         GCC.SEGMENT5,
         GCC.SEGMENT6,
         GCC.SEGMENT7,
         gjh.je_category,
         gjh.je_source,
         gjb.name,
         gjh.name,
         gjh.period_name,
         GL.name


You can find me on Fiverr & LinkedIn

No comments:

Post a Comment