1: PACKAGE BODY CN_QUOTA_ASSIGNS_PKG as
2: /* $Header: cnpliqab.pls 120.2 2005/07/05 09:25:19 appldev ship $ */
3:
4: /*
5:
40: --
41: PROCEDURE get_uid (X_Quota_Assign_Id IN OUT NOCOPY NUMBER ) IS
42: BEGIN
43:
44: SELECT cn_quota_assigns_s.nextval
45: INTO X_Quota_Assign_Id
46: FROM sys.dual;
47:
48: END get_uid;
88: -- has changed.
89: -- must be called aftere the unique checks to ensure the plan
90: -- status is not updated even though the quota in/upd cannot be made.
91:
92: cn_quota_assigns_pkg.check_exists(x_quota_id);
93:
94: cn_comp_plans_pkg.set_status( x_comp_plan_id => x_comp_plan_id
95: ,x_quota_id => null
96: ,x_rate_schedule_id => null
97: ,x_status_code => 'INCOMPLETE'
98: ,x_event => 'CHANGE_COMP_PLAN');
99:
100:
101: INSERT INTO cn_quota_assigns
102: (
103: Quota_Id
104: ,Comp_Plan_Id
105: ,Quota_Assign_Id
225: BEGIN
226:
227: IF (x_quota_id <> x_quota_id_old ) THEN
228:
229: cn_quota_assigns_pkg.check_exists(x_quota_id);
230:
231: cn_comp_plans_pkg.set_status(
232: x_comp_plan_id => x_comp_plan_id
233: ,x_quota_id => null
237:
238: END IF;
239:
240: BEGIN
241: UPDATE cn_quota_assigns
242: SET quota_id = x_quota_id
243: ,comp_plan_id = x_comp_plan_id
244: ,quota_sequence = X_Quota_Sequence
245: ,last_updated_by = fnd_global.user_id
325:
326:
327: CURSOR get_quota_id_for_mark IS
328: Select quota_id
329: from cn_quota_assigns
330: where comp_plan_id = nvl(x_comp_plan_id, comp_plan_id )
331: and quota_assign_id = nvl(x_quota_assign_id, quota_assign_id) ;
332:
333: BEGIN
348:
349: BEGIN
350: IF x_quota_assign_id IS NULL THEN
351:
352: DELETE FROM cn_quota_assigns
353: WHERE comp_plan_id = x_comp_plan_id;
354:
355: ELSE
356: DELETE FROM cn_quota_assigns
352: DELETE FROM cn_quota_assigns
353: WHERE comp_plan_id = x_comp_plan_id;
354:
355: ELSE
356: DELETE FROM cn_quota_assigns
357: WHERE quota_assign_id = x_quota_assign_id
358: AND comp_plan_id = x_comp_plan_id;
359:
360: END IF;
407: PROCEDURE lock_record( x_quota_assign_Id NUMBER
408: ,x_quota_id NUMBER) IS
409: CURSOR c IS
410: SELECT *
411: FROM cn_quota_assigns
412: WHERE quota_assign_id = x_quota_assign_id
413: FOR UPDATE OF quota_assign_id NOWAIT;
414: recinfo c%ROWTYPE;
415:
551: INTO x_dummy
552: FROM sys.dual
553: WHERE NOT EXISTS (
554: SELECT 1
555: FROM cn_quota_assigns
556: WHERE quota_id = x_quota_id
557: AND comp_plan_id = x_comp_plan_id
558: AND ( x_quota_assign_id IS NULL
559: OR quota_assign_id <> x_quota_assign_id))
565: app_exception.Raise_Exception;
566:
567: END Check_duplicate;
568:
569: END CN_QUOTA_ASSIGNS_PKG;