DBA Data[Home] [Help]

APPS.HR_PER_TYPE_USAGE_INTERNAL SQL Statements

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

Line: 66

    select *
    from   per_all_people_f
    where  person_id = p_person_id
    and    p_effective_date
           between effective_start_date
           and     effective_end_date;
Line: 199

procedure delete_person_type_usage
(  p_validate                       in boolean        default false
  ,p_person_type_usage_id           in number
  ,p_effective_date                 in date
  ,p_datetrack_mode                 in varchar2
  ,p_object_version_number          in out nocopy number
  ,p_effective_start_date           out nocopy date
  ,p_effective_end_date             out nocopy date
  ) is
  --
  -- Declare cursors and local variables
  --
  l_proc varchar2(72);
Line: 219

  l_proc := g_package||'delete_person_type_usage';
Line: 226

    savepoint delete_person_type_usage;
Line: 273

    ROLLBACK TO delete_person_type_usage;
Line: 282

end delete_person_type_usage;
Line: 288

procedure update_person_type_usage
(
   p_validate                       in     boolean    default false
  ,p_effective_date                 in     date
  ,p_datetrack_mode                 in     varchar2
  ,p_person_type_usage_id           in     number
  ,p_object_version_number          in out nocopy number
  ,p_person_type_id                 in     number    default hr_api.g_number
  ,p_attribute_category             in     varchar2  default hr_api.g_varchar2
  ,p_attribute1                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute2                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute3                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute4                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute5                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute6                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute7                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute8                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute9                     in     varchar2  default hr_api.g_varchar2
  ,p_attribute10                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute11                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute12                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute13                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute14                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute15                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute16                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute17                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute18                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute19                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute20                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute21                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute22                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute23                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute24                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute25                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute26                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute27                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute28                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute29                    in     varchar2  default hr_api.g_varchar2
  ,p_attribute30                    in     varchar2  default hr_api.g_varchar2
  ,p_effective_start_date           out nocopy    date
  ,p_effective_end_date             out nocopy    date
 ) is
  --
  -- Declare cursors and local variables
  --
  l_effective_start_date per_person_type_usages_f.effective_start_date%TYPE;
Line: 341

    l_proc := g_package||'update_person_type_usage';
Line: 348

    savepoint update_person_type_usage;
Line: 427

    ROLLBACK TO update_person_type_usage;
Line: 440

end update_person_type_usage;
Line: 457

    select *
      from per_person_type_usages_f ptu
     where p_effective_date between ptu.effective_start_date and ptu.effective_end_date
       and ptu.person_type_usage_id = p_person_type_usage_id;
Line: 540

  ,p_datetrack_update_mode          in     varchar2 default hr_api.g_update
  ,p_datetrack_delete_mode          in     varchar2 default null
 ) is
  --
  -- Declare cursors and local variables
  --
  TYPE spt_list IS TABLE OF per_person_types.system_person_type%type
   INDEX BY binary_integer;
Line: 553

  cursor csr_delete_person_type_usages
  (
     p_effective_date                 in     date
    ,p_person_id                      in     number
    ,p_person_type_id                 in     number
   ) is
    select ptu.person_type_usage_id
          ,ptu.object_version_number
      from per_person_type_usages_f ptu
     where p_effective_date between ptu.effective_start_date and ptu.effective_end_date
       and ptu.person_id = p_person_id
       and ptu.person_type_id = p_person_type_id;
Line: 565

  l_delete_person_type_usage csr_delete_person_type_usages%rowtype;
Line: 573

    select ppt.person_type_id
          ,ppt.system_person_type
      from per_person_types ppt
     where ppt.person_type_id = p_person_type_id;
Line: 584

  cursor csr_update_person_type_usages
  (
     p_effective_date                 in     date
    ,p_person_id                      in     number
    ,p_system_person_type             in     varchar2
   ) is
    select ptu.person_type_usage_id
          ,ptu.object_version_number
      from per_person_type_usages_f ptu
     where p_effective_date between ptu.effective_start_date and ptu.effective_end_date
       and ptu.person_id = p_person_id
       and ptu.person_type_id in
             (select ppt.person_type_id
                from per_person_types ppt
               where (  (   p_system_person_type in ('EMP','EX_EMP')
                        and ppt.system_person_type in ('EMP','EX_EMP') )
                     or (   p_system_person_type in ('APL','EX_APL')
                        and ppt.system_person_type in ('APL','EX_APL') )
                     or (   p_system_person_type in ('CWK','EX_CWK')
                        and ppt.system_person_type in ('CWK','EX_CWK') )
                     or (   p_system_person_type = 'OTHER'
                        and ppt.system_person_type = 'OTHER' )));
Line: 607

  l_update_person_type_usage csr_update_person_type_usages%rowtype;
Line: 608

  l_update_person_type_usage1 csr_update_person_type_usages%rowtype;
Line: 619

    select *
    from   per_all_people_f
    where  person_id = p_person_id
    and    p_effective_date
           between effective_start_date
           and     effective_end_date;
Line: 640

    hr_utility.set_location('p_datetrack_update_mode = '||p_datetrack_update_mode,14);
Line: 641

    hr_utility.set_location('p_datetrack_delete_mode = '||p_datetrack_delete_mode,15);
Line: 646

  if (p_datetrack_delete_mode is not null) then
    --
    if g_debug then
      hr_utility.set_location(l_proc, 10);
Line: 654

    open csr_delete_person_type_usages
      (p_effective_date                 => p_effective_date
      ,p_person_id                      => p_person_id
      ,p_person_type_id                 => p_person_type_id
      );
Line: 659

    fetch csr_delete_person_type_usages into l_delete_person_type_usage;
Line: 660

    if (csr_delete_person_type_usages%notfound) then
      --
      if g_debug then
        hr_utility.set_location(l_proc, 20);
Line: 666

      close csr_delete_person_type_usages;
Line: 677

      close csr_delete_person_type_usages;
Line: 681

        ,p_person_type_usage_id           => l_delete_person_type_usage.person_type_usage_id
        );
Line: 684

      delete_person_type_usage
        (p_person_type_usage_id           => l_delete_person_type_usage.person_type_usage_id
        ,p_effective_date                 => p_effective_date
        ,p_datetrack_mode                 => p_datetrack_delete_mode
        ,p_object_version_number          => l_delete_person_type_usage.object_version_number
        ,p_effective_start_date           => l_effective_start_date
        ,p_effective_end_date             => l_effective_end_date
        );
Line: 695

        ,p_person_type_usage_id           => l_delete_person_type_usage.person_type_usage_id
        );
Line: 702

  elsif (p_datetrack_update_mode is not null) then
    --
    if g_debug then
      hr_utility.set_location(l_proc, 40);
Line: 735

      open csr_update_person_type_usages
        (p_effective_date                 => p_effective_date
        ,p_person_id                      => p_person_id
        ,p_system_person_type             => l_person_type.system_person_type
        );
Line: 740

      fetch csr_update_person_type_usages into l_update_person_type_usage;
Line: 741

      if (csr_update_person_type_usages%found) then

        -- Added close
        close csr_update_person_type_usages;
Line: 754

          ,p_person_type_usage_id           => l_update_person_type_usage.person_type_usage_id
          );
Line: 757

        update_person_type_usage
          (p_effective_date                 => p_effective_date
          ,p_datetrack_mode                 => p_datetrack_update_mode
          ,p_person_type_usage_id           => l_update_person_type_usage.person_type_usage_id
          ,p_object_version_number          => l_update_person_type_usage.object_version_number
          ,p_person_type_id                 => p_person_type_id
          ,p_effective_start_date           => l_effective_start_date
          ,p_effective_end_date             => l_effective_end_date
          );
Line: 769

          ,p_person_type_usage_id           => l_update_person_type_usage.person_type_usage_id
          );
Line: 778

        close csr_update_person_type_usages;
Line: 799

          open csr_update_person_type_usages
            (p_effective_date                 => p_effective_date
            ,p_person_id                      => p_person_id
            ,p_system_person_type             => 'OTHER'
            );
Line: 804

          fetch csr_update_person_type_usages into l_update_person_type_usage1;
Line: 805

          if (csr_update_person_type_usages%found) then

            -- Added close
            close csr_update_person_type_usages;
Line: 816

              ,p_person_type_usage_id           => l_update_person_type_usage1.person_type_usage_id
              );
Line: 824

            delete_person_type_usage
              (p_person_type_usage_id           => l_update_person_type_usage1.person_type_usage_id
              ,p_effective_date                 => p_effective_date - 1
              ,p_datetrack_mode                 => 'DELETE'
              ,p_object_version_number          => l_update_person_type_usage1.object_version_number
              ,p_effective_start_date           => l_effective_start_date
              ,p_effective_end_date             => l_effective_end_date
              );
Line: 835

              ,p_person_type_usage_id           => l_update_person_type_usage1.person_type_usage_id
              );
Line: 856

	    open csr_update_person_type_usages
	      (p_effective_date                 => p_effective_date
	      ,p_person_id                      => p_person_id
	      ,p_system_person_type             => system_type(i)
	      );
Line: 861

	    fetch csr_update_person_type_usages into l_update_person_type_usage1;
Line: 862

	    if (csr_update_person_type_usages%found) then
	      l_no_other := 'N';
Line: 867

	    close csr_update_person_type_usages;
Line: 965

    select ptu.person_type_usage_id
          ,ptu.object_version_number
          ,ppt.system_person_type
          ,ptu.effective_start_date
          ,ptu.effective_end_date
      from per_person_types ppt
          ,per_person_type_usages_f ptu
     where ppt.person_type_id = ptu.person_type_id
       and ptu.person_type_usage_id = c_person_type_usage_id
       and ptu.person_id = p_person_id
       and (  (   p_search_type = c_backwards
              and ptu.effective_start_date <= p_effective_date)
           or (   p_search_type = c_forwards
              and ptu.effective_end_date >= p_effective_date) )
  order by decode(p_search_type
                 ,c_backwards,(p_effective_date - ptu.effective_start_date)
                 ,c_forwards,(ptu.effective_end_date - p_effective_date) )
  for update of ptu.person_type_usage_id;
Line: 989

	--cursor update for bug 5706213
    select 	ptu.person_type_usage_id,ptu.effective_start_date,ptu.effective_end_date,object_version_number
    from 	per_person_type_usages_f ptu ,per_person_types ppt
    where	ptu.person_type_usage_id <> p_person_type_usage_id
    and 	ptu.person_id 	= p_person_id
    and     ppt.PERSON_TYPE_ID = ptu.PERSON_TYPE_ID
    and     ppt.system_person_type = 'APL'
    and	    ptu.effective_end_date = p_effective_start_date -1;
Line: 1000

    select max(date_start)
      from per_periods_of_service
     where person_id=p_person_id
       and date_start <= p_effective_date;
Line: 1006

    select max(date_start)
      from per_periods_of_service
     where person_id=p_person_id
       and date_start <= p_effective_date;
Line: 1026

    select *
    from   per_all_people_f
    where  person_id = p_person_id
    and    p_effective_date
           between effective_start_date
           and     effective_end_date;
Line: 1047

    select ptu.person_type_usage_id into c_person_type_usage_id
      from per_person_types ppt
          ,per_person_type_usages_f ptu
     where ppt.person_type_id = ptu.person_type_id
       and ppt.system_person_type = p_system_person_type
       and p_effective_date between ptu.effective_start_date and ptu.effective_end_date
       and ptu.person_id = p_person_id;
Line: 1175

    delete
      from per_person_type_usages_f ptu
     where ptu.effective_start_date >= l_effective_start_date
       and ptu.effective_end_date <= l_effective_end_date
       and ptu.person_type_usage_id = l_person_type_usage_id;
Line: 1186

    update per_person_type_usages_f ptu
       set effective_end_date = l_effective_end_date
     where ptu.effective_end_date = (l_effective_start_date - 1)
       and ptu.person_type_usage_id = l_person_type_usage_id;
Line: 1214

      hr_per_type_usage_internal.delete_person_type_usage
                (p_person_type_usage_id  => csr_ptu_rec.person_type_usage_id
                ,p_effective_date        => csr_ptu_rec.effective_end_date
                ,p_datetrack_mode        =>  hr_api.g_future_change
                ,p_object_version_number => l_object_version_number1
                ,p_effective_start_date  => l_effective_start_date1
                ,p_effective_end_date    => l_effective_end_date1
                );
Line: 1285

    select ptu.person_type_usage_id,
	   ptu.object_version_number,
           effective_start_date,
           effective_end_date
    from   per_person_type_usages_f ptu,
	   per_person_types         pt
    where  ptu.person_id = c_person_id
      and  (c_date between ptu.effective_start_date
		      and ptu.effective_end_date
            or c_date+1 between ptu.effective_start_date
                        and     ptu.effective_end_date
            and c_system_person_type = 'RETIREE'
              )
      and  ptu.person_type_id = pt.person_type_id
      and  pt.system_person_type = c_system_person_type;
Line: 1302

    select *
    from   per_person_type_usages_f
    where  person_type_usage_id  = l_person_type_usages_id
    and    object_version_number = l_object_version_number;
Line: 1308

    select *
    from per_person_type_usages_f
    where person_type_usage_id = l_person_type_usages_id
    and   effective_end_date = l_ptu_effective_start_date-1;
Line: 1314

    select ptu.person_type_usage_id
          ,ptu.object_version_number
          ,ptu.effective_start_date
          ,ptu.effective_end_date
    from per_person_type_usages_f ptu
        ,per_person_types ppt
    where ptu.effective_start_date = l_ptu_effective_start_date
    and   ptu.person_id = p_person_id
    and   ptu.person_type_id = ppt.person_type_id
    and   ppt.system_person_type = 'EX_APL';
Line: 1326

    select ptu.person_type_usage_id
          ,ptu.object_version_number
          ,ptu.effective_start_date
          ,ptu.effective_end_date
    from per_person_type_usages_f ptu
        ,per_person_types ppt
    where ptu.effective_end_date = l_ptu_effective_start_date-1
    and   ptu.person_id = p_person_id
    and   ptu.person_type_id = ppt.person_type_id
    and   ppt.system_person_type = 'APL';
Line: 1338

    select ptu.person_type_usage_id
          ,ptu.object_version_number
          ,ptu.effective_start_date
          ,ptu.effective_end_date
    from per_person_type_usages_f ptu
        ,per_person_types ppt
    where ptu.effective_end_date = l_ptu_effective_start_date-1
    and   ptu.person_id = p_person_id
    and   ptu.person_type_id = ppt.person_type_id
    and   ppt.system_person_type = 'OTHER';
Line: 1352

  select 'Y'
  from dual
  where exists (select p1.assignment_id
              from per_all_assignments_f p1,
              per_all_assignments_f p2
              where p1.assignment_type='A'
              and p2.assignment_type='E'
              and p1.assignment_id=p2.assignment_id
              and p1.person_id=p_person_id);
Line: 1386

   ** Update the PTU record. This will require a direct update since the
   ** API does not allow for updates to effective_start_date.
   **
   ** NB. Need also to move the end date of any previous EX record
   **     or OTHER record if one exists as of the day before p_old_date_start
   **     but raise error if this comes before the effective_start_date on the same row
   */
   --
   open c1;
Line: 1408

   update PER_PERSON_TYPE_USAGES_F
      set effective_start_date  = p_date_start,
          object_version_number = object_version_number+1
    where person_type_usage_id  = l_person_type_usages_id
      and object_version_number = l_object_version_number
      and effective_start_date = l_ptu_effective_start_date
      and effective_end_date = l_ptu_effective_end_date;
Line: 1427

       update PER_PERSON_TYPE_USAGES_F
	  set effective_end_date    = p_date_start-1,
              object_version_number = object_version_number+1
        where person_type_usage_id  = l_person_type_usages_id
          and object_version_number = l_ptu_prev_row.object_version_number;
Line: 1446

	update PER_PERSON_TYPE_USAGES_F
	   set effective_end_date    = p_date_start-1,
	       object_version_number = object_version_number+1
         where person_type_usage_id  = l_prev_other_row.person_type_usage_id
	   and object_version_number = l_prev_other_row.object_version_number;
Line: 1463

      update PER_PERSON_TYPE_USAGES_F
	 set effective_start_date  = p_date_start,
	     object_version_number = object_version_number+1
       where person_type_usage_id  = l_prev_other_row.person_type_usage_id
	 and object_version_number = l_prev_other_row.object_version_number;
Line: 1477

        update PER_PERSON_TYPE_USAGES_F
	   set effective_end_date    = p_date_start-1,
	       object_version_number = object_version_number+1
         where person_type_usage_id  = l_prev_other_row.person_type_usage_id
	   and object_version_number = l_prev_other_row.object_version_number;
Line: 1537

     select max (effective_start_date),max(effective_end_date)
         from per_person_type_usages_f
         where person_type_usage_id = c_person_type_usage_id ;
Line: 1558

    select *
    from   per_all_people_f
    where  person_id = p_person_id
    and    p_effective_date
           between effective_start_date
           and     effective_end_date;
Line: 1580

    select ptu.person_type_usage_id into c_person_type_usage_id
      from per_person_types ppt
          ,per_person_type_usages_f ptu
     where ppt.person_type_id = ptu.person_type_id
       and ppt.system_person_type = p_system_person_type
       and p_effective_date between ptu.effective_start_date and ptu.effective_end_date
       and ptu.person_id = p_person_id;
Line: 1649

    delete
      from per_person_type_usages_f ptu
     where ptu.effective_start_date >= l_effective_start_date
       and ptu.effective_end_date <= l_effective_end_date
       and ptu.person_type_usage_id = c_person_type_usage_id;
Line: 1668

    update per_person_type_usages_f ptu
       set effective_end_date = l_effective_end_date
     where ptu.effective_end_date = (l_effective_start_date - 1)
       and ptu.person_type_usage_id = c_person_type_usage_id;
Line: 1675

  update per_person_type_usages_f ptu
  set effective_end_date = l_effective_end_date
  where ptu.effective_end_date = (l_effective_start_date - 1)
  and ptu.person_type_usage_id =  ( select distinct (person_type_usage_id)
                                    from per_person_type_usages_f ppf,
                                     per_person_types ppt
                                    where ppf.person_id = p_person_id
                                    and ppt.PERSON_TYPE_ID = ppf.PERSON_TYPE_ID
                                    and  ppt.system_person_type = 'APL'
        and effective_end_date = l_effective_start_date -1 );