Oracle Apps Tech

Tuesday, April 24, 2012

Read Transaction Document from HR_API_TRANSACTIONS CLOB Data

Useful Queries
-----------------
Query 1:
SELECT extractvalue(VALUE(xx_row), '/ObjectiveEORow/Name') AS objective_name,
       extractvalue(VALUE(xx_row), '/ObjectiveEORow/StartDate') AS objective_start_date,
       decode(extractvalue(VALUE(xx_row),
                           '/ObjectiveEORow/WeightingPercent'),
              '(null)',
              0,
              '',
              0,
              extractvalue(VALUE(xx_row), '/ObjectiveEORow/WeightingPercent')) AS weightingpercent,
       extractvalue(VALUE(xx_row), '/ObjectiveEORow/GroupCode') AS groupcode,
       decode(extractvalue(VALUE(xx_row), '/ObjectiveEORow/ObjectiveId'),
              '(null)',
              0,
              extractvalue(VALUE(xx_row), '/PerAbsenceAttendancesEORow/AbsenceAttendanceId')) AS objectiveid
 
 
  SELECT  extractvalue(VALUE(xx_row), '/CNode/AbsenceAction') AS objective_name
  FROM HR_API_TRANSACTIONS xx_api,
       TABLE(xmlsequence(extract(xmlparse(document transaction_document
                                          wellformed),
                                 '/Transaction/TransCtx/CNode'))) xx_row
 WHERE xx_api.transaction_ref_id = *** Transaction id ********
------------------------------------------------------------------------------------------------
Query2: Leave Absence Cancelation employees

  SELECT selected_person_id, extractvalue(VALUE(xx_row), '/CNode/AbsenceAction') AS objective_name
  FROM HR_API_TRANSACTIONS xx_api,
       TABLE(xmlsequence(extract(xmlparse(document transaction_document
                                          wellformed),
                                 '/Transaction/TransCtx/CNode'))) xx_row
 WHERE extractvalue(VALUE(xx_row), '/CNode/AbsenceAction') = 'CancelMode'
 and TRANSACTION_REF_TABLE like 'PER_ABSENCE_ATTENDANCES'
 and trunc(creation_date) = trunc(sysdate)

No comments:

Post a Comment