12: acb.user_code = p_code
13: And acb.payroll_action_id =
14: (
15: Select max(sub.payroll_action_id)
16: From pay_za_acb_user_gen_nos sub
17: Where sub.user_code = p_code
18: )
19: And not exists
20: (
18: )
19: And not exists
20: (
21: Select 1
22: From pay_za_acb_user_gen_nos sub
23: Where sub.payroll_action_id = p_payroll_action_id
24: And sub.user_code = p_code
25: )
26: Union
80: Where
81: not exists
82: (
83: Select 1
84: From pay_za_acb_user_gen_nos sub
85: Where sub.payroll_action_id = p_payroll_action_id
86: And sub.user_code = p_user_code
87: );
88:
141: Where
142: not exists
143: (
144: Select 1
145: From pay_za_acb_user_gen_nos sub
146: Where sub.payroll_action_id = p_payroll_action_id
147: And sub.user_code = p_acb_inst_code
148: );
149: Else
152:
153: /* Select the next installation gen no from sequence */
154:
155: Select
156: pay_za_acb_user_gen_nos_s.nextval into inst_gen
157: From
158: sys.dual;
159:
160: /* Check that installation gen no > user gen, since the