DBA Data[Home] [Help]

APPS.PER_MX_SSAFFL_ARCHIVE SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 170

   select fnd_date.canonical_to_date(legislation_info1)
   from pay_mx_legislation_info_f
   where legislation_info_type='MX Social Security Reporting' ;
Line: 209

   select  fnd_date.canonical_to_date(ltrim(rtrim(substr(ppa.legislative_parameters,
                instr(ppa.legislative_parameters,
                         'END_DATE=')
                + length('END_DATE='),
                (instr(ppa.legislative_parameters,
                         'LEGAL_EMPLOYER=') - 1 )
              - (instr(ppa.legislative_parameters,
                         'END_DATE=')
              + length('END_DATE='))))))
   from pay_assignment_actions paa,
       pay_payroll_actions ppa
   where paa.tax_unit_id = cp_tax_unit_id
    and ppa.payroll_action_id=paa.payroll_action_id
    and ppa.report_type='SS_AFFILIATION'
    and ppa.report_qualifier ='IMSS'
   order by paa.payroll_action_id desc ;
Line: 229

    select fnd_date.canonical_to_date(org_information6)
    from hr_organization_information
    where org_information_context= 'MX_TAX_REGISTRATION'
    and organization_id = cp_organization_id ;
Line: 295

      select business_group_id,
             to_number(substr(legislative_parameters,
                    instr(legislative_parameters,
                    'GRE_ID=')
                + length('GRE_ID='))) , -- gre_id
             to_number(ltrim(rtrim(substr(legislative_parameters,
                instr(legislative_parameters,
                         'TRANS_GRE=')
                + length('TRANS_GRE='),
                (instr(legislative_parameters,
                         'GRE_ID=') - 1 )
              - (instr(legislative_parameters,
                         'TRANS_GRE=')
              + length('TRANS_GRE=')))))) , -- trans_gre

             to_number(ltrim(rtrim(substr(legislative_parameters,
                instr(legislative_parameters,
                         'LEGAL_EMPLOYER=')
                + length('LEGAL_EMPLOYER='),
                (instr(legislative_parameters,
                         'TRANS_GRE=') - 1 )
              - (instr(legislative_parameters,
                         'LEGAL_EMPLOYER=')
              + length('LEGAL_EMPLOYER=')))))) , -- legal_employer

             fnd_date.canonical_to_date(ltrim(rtrim(substr(legislative_parameters,
                instr(legislative_parameters,
                         'END_DATE=')
                + length('END_DATE='),
                (instr(legislative_parameters,
                         'LEGAL_EMPLOYER=') - 1 )
              - (instr(legislative_parameters,
                         'END_DATE=')
              + length('END_DATE=')))))),  -- end_date

             fnd_date.canonical_to_date(ltrim(rtrim(substr(legislative_parameters,
                instr(legislative_parameters,
                         'START_DATE=')
                + length('START_DATE='),
                (instr(legislative_parameters,
                         'END_DATE=') - 1 )
              - (instr(legislative_parameters,
                         'START_DATE=')
              + length('START_DATE='))))))  -- start_date
      from pay_payroll_actions
      where payroll_action_id = cp_payroll_action_id;
Line: 344

    select fnd_date.canonical_to_date(org_information6)
    from hr_organization_information
    where org_information_context= 'MX_TAX_REGISTRATION'
    and organization_id = cp_organization_id ;
Line: 351

    select event_group_id
    from pay_event_groups
    where event_group_name = cp_event_group_name ;
Line: 448

   Purpose   : This returns the select statement that is
               used to created the range rows for the
               Social Security Affiliation Archiver.
   Notes     : Calls procedure - get_payroll_action_info
  ******************************************************************/
  PROCEDURE range_cursor( p_payroll_action_id in        number
                         ,p_sqlstr           out nocopy varchar2)
  IS

    CURSOR c_chk_dyn_triggers_enabled(cp_func_area in VARCHAR2)
    IS
    select /*+INDEX(PFA PAY_FUNCTIONAL_AREAS_PK)
              INDEX(PTE PAY_TRIGGER_EVENTS_PK)*/
	      pte.short_name
    from pay_functional_areas pfa,
         pay_functional_triggers pft,
         pay_trigger_events     pte
    where pfa.short_name = cp_func_area
    and   pfa.area_id = pft.area_id
    and   pft.event_id = pte.event_id
    and ( pte.generated_flag <> 'Y' or pte.enabled_flag <> 'Y' ) ;
Line: 530

        lv_sql_string := 'select distinct ppe.assignment_id
          from pay_process_events ppe,
             pay_event_updates  peu,
             pay_datetracked_events pde
        where ppe.creation_date between
        fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_start_date) || ''')
        and fnd_date.canonical_to_date(''' || fnd_date.date_to_canonical(ld_end_date) || ''')
        and ppe.event_update_id = peu.event_update_id
        and peu.dated_table_id = pde.dated_table_id
        and pde.event_group_id = ''' ||ln_event_group_id || '''
        and ppe.business_group_id = ''' ||ln_business_group_id || '''
        and (( decode(peu.column_name,''EFFECTIVE_END_DATE'',''1'') = nvl(pde.column_name,''1'')
        and decode(peu.event_type,''U'',''E'')=pde.update_type )
        or ( nvl(peu.column_name,1) = nvl(pde.column_name,1)
             and peu.event_type=pde.update_type ))
        and :payroll_action_id > 0 ' ;
Line: 630

   select distinct ppe.assignment_id
--        ,paf.person_id,
--        ,per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf.location_id,paf.business_group_id,paf.soft_coding_keyflex_id,ppe.effective_date)
          from pay_process_events ppe,
               pay_event_updates  peu,
               pay_datetracked_events pde,
               per_all_assignments_f  paf
          where ppe.creation_date between cp_start_date and cp_end_date
            and peu.event_update_id = ppe.event_update_id
            and ppe.business_group_id = cp_business_group_id
            and pde.dated_table_id = peu.dated_table_id
            and pde.event_group_id = cp_event_group_id
            and (( decode(peu.column_name,'EFFECTIVE_END_DATE','1') = nvl(pde.column_name,'1')
            and decode(peu.event_type,'U','E')=pde.update_type )
            or ( nvl(peu.column_name,1) = nvl(pde.column_name,1)
                 and peu.event_type=pde.update_type ) )
            and  paf.assignment_id = ppe.assignment_id
            and paf.assignment_id between cp_start_assignment_id and cp_end_assignment_id
            and ppe.effective_date between paf.effective_start_date and paf.effective_end_date
            and (( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf.location_id,paf.business_group_id,paf.soft_coding_keyflex_id,ppe.effective_date) = -1 )
              or ( per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf.location_id,paf.business_group_id,paf.soft_coding_keyflex_id,ppe.effective_date) = -2 )
              or ( cp_tran_gre_id is not null and cp_gre_id is not null and
                   per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf.location_id,paf.business_group_id,paf.soft_coding_keyflex_id,ppe.effective_date)=cp_gre_id )
              or ( cp_tran_gre_id is not null and cp_gre_id is null and
                   per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf.location_id,paf.business_group_id,paf.soft_coding_keyflex_id,ppe.effective_date)
                   in
                   (select organization_id
                    from hr_organization_information hoi
                    where  hoi.org_information_context = 'MX_SOC_SEC_DETAILS'
                    and ((org_information6 = cp_tran_gre_id ) OR ( organization_id = cp_tran_gre_id and org_information3='Y'))))) ;
Line: 738

        select pay_assignment_actions_s.nextval
        into ln_action_id
        from dual;
Line: 824

  select 'Y'
  from per_all_assignments_f paf
  where paf.assignment_id <> cp_skip_assignment_id
    and paf.person_id = cp_person_id
    and cp_effective_date between paf.effective_start_date and paf.effective_end_date
    and per_mx_ssaffl_archive.derive_gre_from_loc_scl(paf.location_id,paf.business_group_id,paf.soft_coding_keyflex_id,cp_effective_date)
      = cp_gre_id ;
Line: 862

  select sum(decode(to_number(puci.value),0,0,1))
  from pay_user_column_instances_f puci,
        pay_user_columns puc
  where puc.user_column_name = cp_workschedule
  and puc.legislation_code='MX'
  and puc.user_column_id = puci.user_column_id ;
Line: 910

  select replace(ppf.per_information3,'-','')  emp_ss_number
        ,ppf.last_name            paternal_last_name
        ,ppf.per_information1     maternal_last_name
        ,ppf.first_name || ' ' ||ppf.middle_names   name
        ,ppf.employee_number      worker_id
  from per_all_assignments_f paf,
       per_all_people_f ppf
  where paf.assignment_id = cp_assignment_id
    and paf.person_id = ppf.person_id
    and cp_effective_date between paf.effective_start_date and paf.effective_end_date
    and cp_effective_date between ppf.effective_start_date and ppf.effective_end_date ;
Line: 924

  select org_information1
  from hr_organization_information
  where org_information_context= 'MX_SOC_SEC_DETAILS'
  and organization_id = cp_gre_id ;
Line: 931

  select org_information3,org_information5, org_information6
  from hr_organization_information
  where org_information_context= 'MX_SOC_SEC_DETAILS'
  and organization_id = cp_organization_id ;
Line: 941

  select aei_information3
  from per_assignment_extra_info pae
  where pae.assignment_id = cp_assignment_id
  and information_type = 'MX_SS_EMP_TRANS_REASON'
  and fnd_date.canonical_to_date(aei_information1) = cp_effective_date
  and aei_information2 = cp_gre_id ;
Line: 951

  select pds_information1, actual_termination_date
  from per_periods_of_service ppos,
       per_all_assignments_f paf
  where paf.assignment_id = cp_assignment_id
    and paf.person_id = ppos.person_id
    and cp_effective_date between paf.effective_start_date and paf.effective_end_date
    and pds_information_category='MX' ;
Line: 1157

  select replace(ppf.per_information3,'-','')   emp_ss_number
        ,ppf.last_name            paternal_last_name
        ,per_information1         maternal_last_name
        ,ppf.first_name || ' ' || ppf.middle_names   name
        ,substr(employment_category,3,1) worker_type
        ,hsc.segment6             salary_type
        ,puc.user_column_name     work_schedule
        ,per_information4         med_center
        ,employee_number          worker_id
        ,national_identifier      CURP
  from per_all_assignments_f paf,
       per_all_people_f ppf,
       hr_soft_coding_keyflex hsc,
       pay_user_columns puc
  where paf.assignment_id = cp_assignment_id
    and paf.person_id = ppf.person_id
    and paf.soft_coding_keyflex_id = hsc.soft_coding_keyflex_id (+)
    and hsc.segment4 = puc.user_column_id(+)
    and trunc(cp_effective_date) between paf.effective_start_date and paf.effective_end_date
    and trunc(cp_effective_date) between ppf.effective_start_date and ppf.effective_end_date ;
Line: 1180

  select replace(org_information1,'-','')
  from hr_organization_information
  where org_information_context= 'MX_SOC_SEC_DETAILS'
  and organization_id = cp_gre_id ;
Line: 1187

  select org_information3,org_information5, org_information6
  from hr_organization_information
  where org_information_context= 'MX_SOC_SEC_DETAILS'
  and organization_id = cp_organization_id ;
Line: 1196

  select legislation_info2
  from pay_mx_legislation_info_f
  where legislation_info_type='MX Minimum Wage Information'
  and legislation_info1='MWA'
  and cp_effective_date between effective_start_date and effective_end_date ;
Line: 1369

     dbg('call api to insert the record in pay action information with parameters' );
Line: 1465

  select location_code
  from hr_locations
  where location_id = cp_location_id ;
Line: 1471

  select name
  from hr_organization_units
  where organization_id = cp_gre_id ;
Line: 1574

   Name      : process_insert_event
   Purpose   : This procedure process insert event.
               This procedure is called
               from interpret_all_asg_events procedure
  ************************************************************/
  PROCEDURE process_insert_event(
                 p_assignment_action_id  in number
                ,p_assignment_id   in number
                ,p_effective_date  in date
                )
  IS

  -- Cursor to check the record exist in the archive table
  cursor c_chk_archive ( cp_person_id in number,
                         cp_gre_id    in number,
                         cp_effective_date date,
                         cp_action_info_category varchar2 )
  is
  select 'Y'
  from pay_action_information pai,
       per_all_assignments_f paf
  where pai.action_context_type ='AAP'
   and  pai.action_information_category = cp_action_info_category
   and  pai.tax_unit_id = cp_gre_id
   and  pai.assignment_id = paf.assignment_id
   and  paf.person_id = cp_person_id
   and  cp_effective_date between paf.effective_start_date and paf.effective_end_date
   order by pai.effective_date desc ;
Line: 1607

  select paf.person_id,
         paf.assignment_number,
         paf.location_id,
         paf.soft_coding_keyflex_id,
         paf.business_group_id
  from per_all_assignments_f paf
  where paf.assignment_id = cp_assignment_id
    and cp_effective_date between paf.effective_start_date
       and paf.effective_end_date ;
Line: 1634

     dbg('Entering process insert event..........' );
Line: 1636

     lv_procedure_name         := '.process_insert_event';
Line: 1782

    dbg('Exiting process insert event..........' );
Line: 1791

  END process_insert_event ;
Line: 1816

  select person_id,
         assignment_number,
         location_id,
         soft_coding_keyflex_id,
         business_group_id
  from per_all_assignments_f paf
  where paf.assignment_id = cp_assignment_id
    and cp_effective_date between paf.effective_start_date
       and paf.effective_end_date ;
Line: 1833

  select 'Y'
  from pay_action_information pai,
       per_all_assignments_f paf
  where pai.action_context_type ='AAP'
   and  pai.action_information_category = cp_action_info_category
   and  pai.tax_unit_id = cp_gre_id
   and  pai.assignment_id = paf.assignment_id
   and  paf.person_id = cp_person_id
   and  cp_effective_date between paf.effective_start_date and paf.effective_end_date
   order by pai.effective_date desc ;
Line: 2123

   Name      : process_update_event
   Purpose   : This procedure process the update event.
               This procedure is called
               from interpret_all_asg_events procedure
  ************************************************************/
  PROCEDURE process_update_event  ( p_assignment_action_id  in number
                                   ,p_assignment_id   in number
                                   ,p_effective_date  in date
                                   ,p_column_name     in varchar
                                   ,p_old_value       in number
                                   ,p_new_value       in number
                                   ,p_column_name1    in varchar
                                   ,p_old_value1      in number
                                   ,p_new_value1      in number
                                   )
  IS

  -- Cursor to get person details
  cursor c_person_details(cp_assignment_id  in number,
                       cp_effective_date in date )
  is
  select person_id,
         assignment_number,
         location_id,
         soft_coding_keyflex_id,
         business_group_id
  from per_all_assignments_f paf
  where paf.assignment_id = cp_assignment_id
    and cp_effective_date between paf.effective_start_date
       and paf.effective_end_date ;
Line: 2160

  select 'Y'
  from pay_action_information pai,
       per_all_assignments_f paf
  where pai.action_context_type ='AAP'
   and  pai.action_information_category = cp_action_info_category
   and  pai.tax_unit_id = cp_gre_id
   and  pai.assignment_id = paf.assignment_id
   and  cp_effective_date between paf.effective_start_date and paf.effective_end_date
   and  paf.person_id = CP_PERSON_ID
   order by pai.effective_date desc ;
Line: 2196

    dbg('Entering process_update_event ..........');
Line: 2201

    lv_procedure_name            := '.process_update_event';
Line: 2421

     dbg('Exiting process update event..........' );
Line: 2431

  END process_update_event;
Line: 2451

  select paf.person_id,paf.assignment_number,paf.location_id,
         paf.soft_coding_keyflex_id, pas.per_system_status,
         paf.business_group_id
  from per_all_assignments_f paf,
       per_assignment_status_types pas
  where paf.assignment_id = cp_assignment_id
    and pas.assignment_status_type_id = paf.assignment_status_type_id
    and cp_effective_date between paf.effective_start_date
       and paf.effective_end_date ;
Line: 2466

  select 'Y'
  from pay_action_information pai
  where pai.action_context_type ='AAP'
   and  pai.action_information_category = cp_action_info_category
   and  pai.assignment_id = cp_assignment_id
   and  trunc(pai.effective_date) = trunc(cp_effective_date) ;
Line: 2642

  select PER_SYSTEM_STATUS from per_assignment_status_types
  where assignment_status_type_id = cp_assignment_status_type_id ;
Line: 2667

  lv_insert_found       VARCHAR2(1);
Line: 2713

           dbg('Update_type      : '||int_pkg_events(i).update_type ) ;
Line: 2723

          1) User Entry      : Insert record
                               on 01-JAN-2004 record created
                               (default record inserted while entering the person record)
             Int pkg Returns : Returns one record
             Process         : Process only the insert record

          2) User Entry      : Insert followed by multiple correction record
                               a)on 01-JAN-2004   record inserted
                               b)DTrack 01-JAN-2004 corrected either location or GRE in the SCL

             Int pkg Returns : Returns 3 records
                               i)  Insert
                               ii) Location correction
                               iii)SCL correction

             Process         : Process only the insert and skip the correction records

          3) User Entry      : Insert record and Update record followed by correction record
                               a)on 01-JAN-2004   record inserted
                               b)DTrack 05-JAN-2004 updated either location or GRE in the SCL
                               c)DTrack 05-JAN-2004 corrected either location or GRE in the SCL

             Int pkg Returns : Returns 5 records
                               i) insert
                               ii) Location update
                               iii) SCL update
                               iv) location correction
                                v) SCL Correction

             Process          : process insert and update record with the last correction record.

          4) User Entry       : Single or multiple correction record
                                a)DTrack 05-JAN-2004 corrected either location or GRE in the SCL
             Int Pkg Returns  : Single or Multiple records
             Process          : Process the last correction record
             Example   05-JAN-2004   A  to B  on last update date 06-Jan-2004 at 10:00 am
                       05-JAN-2004   B  to C  on last update date 06-Jan-2004 at 11:00 am
                       05-JAN-2004   c  to D  on last update date 06-Jan-2004 at 12:00 am
             Take the last record and new value is D

          5) User Entry       : Single or multiple update record
                                a)DTrack 05-FEB-2004 updated either location or GRE in the SCL
             Int Pkg Returns  : Single or Multiple records
             Process          : Process the update record with both location and scl

          6) User Entry       : Multiple update record followed by correction record
                                a)DTrack 05-MAR-2004 updated both location and GRE in the SCL
                                b)DTrack 05-MAR-2004 corrected both location and GRE in the SCL
             Int Pkg Returns  : Single or Multiple records
             Process          : Process the update record with the correction value

          7) User Entry       : Hire, Correction and Terminate record
                                a)DTrack 01-JUL-2004 record Inserted
                                b)DTrack 01-JUL-2004 corrected both location and GRE in the SCL
                                C)End Employement on 31-JUL-2004 with
                                  actual_termination_date = final process date = 31-JUL-2004
             Int Pkg Returns  : Single or Multiple records
             Process          : Process Insert, correction and termination record

          8) User Entry       : Hire, Correction,Terminate record and Reverse terminate
                                a)DTrack 01-JUL-2004 record Inserted
                                b)DTrack 01-JUL-2004 corrected both location and GRE in the SCL
                                C)End Employement on 31-JUL-2004 with
                                  actual_termination_date = final process date = 31-JUL-2004
                                d)Reverse Terminate
             Int Pkg Returns  : Single or Multiple records
             Process          : Process Insert, correction records ( ignore termination and
                                   corresponding reverse termination)
          9) User Entry       : Hire, Correction and Terminate record
                                a)DTrack 01-JUL-2004 record Inserted
                                b)DTrack 01-JUL-2004 corrected both location and GRE in the SCL
                                C)End Employement on 31-JUL-2004 with
                                  actual_termination_date = 31-JUL-2004
                                  final process date = null
             Int Pkg Returns  : Single or Multiple records
             Process          : Process Insert, correction and termination record

          10)User Entry       : Hire, Correction,Terminate record and Reverse terminate
                                a)DTrack 01-JUL-2004 record Inserted
                                b)DTrack 01-JUL-2004 corrected both location and GRE in the SCL
                                C)End Employement on 31-JUL-2004 with
                                  actual_termination_date =  31-JUL-2004
                                  final process date = null
                                d)Reverse Terminate
             Int Pkg Returns  : Single or Multiple records
             Process          : Process Insert, correction records ( ignore termination and
                                   corresponding reverse termination)
       */

       hr_utility.set_location(gv_package || lv_procedure_name, 20);
Line: 2824

           dbg('Update_type      : '||int_pkg_events(i).update_type ) ;
Line: 2830

           if int_pkg_events(i).update_type ='I'  then
               ln_index := asg_events_table.COUNT + 1 ;
Line: 2832

               asg_events_table(ln_index).update_type    := int_pkg_events(i).update_type ;
Line: 2838

           elsif int_pkg_events(i).update_type ='E' then
                 -- convert the values from change_values to old and new value
                 -- change values will have  ->  ie 31-DEC-12 -> 31-JUL-04
                 lv_change_values := int_pkg_events(i).change_values ;
Line: 2854

                 asg_events_table(ln_index).update_type    := int_pkg_events(i).update_type ;
Line: 2861

                 (int_pkg_events(i).update_type ='C' or
                  int_pkg_events(i).update_type ='U' ) THEN

                  -- convert the values from change_values to old and new value
                  dbg( 'convert the values from change_values to old and new value' );
Line: 2866

                  if int_pkg_events(i).update_type = 'C' then
                      -- change values will have  ->  ie 590 -> 610
                      lv_change_values := int_pkg_events(i).change_values ;
Line: 2879

                  elsif int_pkg_events(i).update_type = 'U' then
                      lv_old_value := int_pkg_events(i).old_value  ;
Line: 2907

                    asg_events_table(ln_index).update_type    := 'E' ;
Line: 2919

                 ( int_pkg_events(i).update_type ='C' or
                   int_pkg_events(i).update_type ='U' ) THEN

               -- check the row exists in asg_events_table with matching effective_date and
               -- update_type = I
               lV_insert_found := 'N' ;
Line: 2928

                      asg_events_table(j).update_type    = 'I' ) then
                      lV_insert_found :='Y' ;
Line: 2933

               if lV_insert_found = 'Y' then
                  dbg( 'row skipped from int_pkg_events as the insert record exists on the same effective date' );
Line: 2938

                   if int_pkg_events(i).update_type = 'C' then
                      -- change values will have  ->  ie 590 -> 610
                      lv_change_values := int_pkg_events(i).change_values ;
Line: 2951

                  elsif int_pkg_events(i).update_type = 'U' then
                      lv_old_value := int_pkg_events(i).old_value  ;
Line: 2964

                       (asg_events_table(j).update_type = 'U' or asg_events_table(j).update_type = 'C')
                      ) then

                      lV_row_found :='Y' ;
Line: 2982

                      dbg( 'row updated with current value as multiple correction/update record found' );
Line: 2990

                     asg_events_table(ln_index).update_type    := int_pkg_events(i).update_type ;
Line: 3004

               end if; --lv_insert_found
Line: 3005

           end if; -- update_type
Line: 3019

          dbg('Update Type    :' || asg_events_table(i).update_type );
Line: 3028

          if asg_events_table(i).update_type = 'I' then

              dbg('call process insert event' );
Line: 3031

              msg('Processing Insert Event' );
Line: 3032

              process_insert_event( p_assignment_action_id
                                   ,p_assignment_id
                                   ,asg_events_table(i).effective_date
                                  ) ;
Line: 3037

           elsif asg_events_table(i).update_type = 'E' then

              dbg('call process_endate_event' );
Line: 3048

           elsif ( asg_events_table(i).update_type = 'C' or
                   asg_events_table(i).update_type = 'U' ) then

               dbg('Event update type is C or U ' );
Line: 3077

               dbg('Update Type    :' || asg_events_table(i).update_type );
Line: 3085

               if asg_events_table(i).update_type = 'C' then

                  dbg('call process_correction_event' );
Line: 3103

                  dbg('call process_update_event' );
Line: 3104

                  msg('Processing Update Event' );
Line: 3105

                  process_update_event( p_assignment_action_id
                                    ,p_assignment_id
                                    ,asg_events_table(i).effective_date
                                    ,asg_events_table(i).column_name
                                    ,ln_old_value
                                    ,ln_new_value
                                    ,asg_events_table(i).column_name1
                                    ,ln_old_value1
                                    ,ln_new_value1
                                    );
Line: 3147

      select paa.payroll_action_id,
             paa.assignment_id,
             paa.tax_unit_id
        from pay_assignment_actions paa
       where paa.assignment_action_id = cp_assignment_action;