DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_KR_HIA_FUNC_PKG

Source


1 package body pay_kr_hia_func_pkg as
2 /* $Header: pykrhiafn.pkb 120.0 2005/05/29 10:45:55 appldev noship $ */
3 
4     /*************************************************************************
5      * This function is used to get the comma-separated concatenation of
6      * all business places under a HI Business Place
7      *************************************************************************/
8 
9     function get_concat_bp_names (
10         p_payroll_action_id      in number,
11         p_hi_bp_number           in varchar2,
12         p_trunc_length           in number
13         ) return varchar2
14     is
15 	cursor bp_names is
16 	select  hou1.name
17 	from 	hr_organization_units       hou1,
18 		hr_organization_information hoi2,
19 		pay_payroll_actions         ppa
20 	where   ppa.payroll_action_id        = p_payroll_action_id
21 	and     hou1.business_group_id       = ppa.business_group_id
22 	and     hou1.organization_id         = hoi2.organization_id
23 	and     hoi2.org_information_context = 'KR_HI_INFORMATION'
24 	and     hoi2.org_information1        = p_hi_bp_number;
25 
26 
27         l_concat varchar2(1000);
28         l_length number;
29 
30     begin
31 
32         if(p_trunc_length > 1000) then
33             l_length := 1000;
34         else
35             l_length := p_trunc_length;
36         end if;
37 
38 	for rec in bp_names
39 	loop
40 	    l_concat  := substr(l_concat ||rec.name,0 ,l_length);
41 	    l_concat  := substr(l_concat || ', ',0 ,l_length);
42 	end loop;
43 
44 	l_concat  := rtrim(l_concat, ', ');
45 	return l_concat;
46 
47     end get_concat_bp_names;
48 
49 begin
50     null;
51 end pay_kr_hia_func_pkg;