DBA Data[Home] [Help]

PACKAGE BODY: APPS.AMS_DMLIFT_PUB

Source


1 PACKAGE BODY AMS_Dmlift_PUB as
2 /* $Header: amspdlfb.pls 115.4 2002/01/07 18:52:02 pkm ship      $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 --          AMS_Dmlift_PUB
7 -- Purpose
8 --
9 -- History
10 -- 21-Jan-2001 choang   Added overload procedure create_lift for
11 --                      ODM Accelerator integration.
12 -- 12-Feb-2001 choang   Removed rollback and savepoints for create_lift
13 --                      to be used by ODM Accelerator.
14 -- 12-Feb-2001 choang   Added call to validate_lift in create_lift for
15 --                      odm.
16 -- 07-Jan-2002 choang   removed security_group_id
17 --
18 -- NOTE
19 --
20 -- End of Comments
21 -- ===============================================================
22 
23 
24 G_PKG_NAME CONSTANT VARCHAR2(30):= 'AMS_Dmlift_PUB';
25 G_FILE_NAME CONSTANT VARCHAR2(12) := 'amspdlfb.pls';
26 
27 PROCEDURE Lock_Dmlift(
28     p_api_version    IN   NUMBER,
29     p_init_msg_list  IN   VARCHAR2 := FND_API.G_FALSE,
30     x_return_status  OUT  VARCHAR2,
31     x_msg_count      OUT  NUMBER,
32     x_msg_data       OUT  VARCHAR2,
33 
34     p_lift_id        IN  NUMBER,
35     p_object_version IN  NUMBER
36 )
37 IS
38    L_API_NAME                  CONSTANT VARCHAR2(30) := 'Lock_Dmlift';
39    L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
40    l_pvt_Lift_rec    AMS_DMLift_PVT.Lift_rec_type;
41 BEGIN
42       -- Standard call to check for call compatibility.
43       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
44                                            p_api_version,
45                                            l_api_name,
46                                            G_PKG_NAME)
47       THEN
48           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
49       END IF;
50 
51       -- Initialize message list if p_init_msg_list is set to TRUE.
52       IF FND_API.to_Boolean( p_init_msg_list )
53       THEN
54          FND_MSG_PUB.initialize;
55       END IF;
56 
57       -- Debug Message
58       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'start');
59 
60 
61       -- Initialize API return status to SUCCESS
62       x_return_status := FND_API.G_RET_STS_SUCCESS;
63 
64       --
65       -- API body
66       --
67     -- Calling Private package: Create_Lift
68     -- Hint: Primary key needs to be returned
69      AMS_DMLift_PVT.Lock_Dmlift(
70      p_api_version         => 1.0,
71      p_init_msg_list              => FND_API.G_FALSE,
72      x_return_status              => x_return_status,
73      x_msg_count                  => x_msg_count,
74      x_msg_data                   => x_msg_data,
75      p_lift_id     => p_lift_id,
76      p_object_version             => p_object_version);
77 
78 
79       -- Check return status from the above procedure call
80       IF x_return_status = FND_API.G_RET_STS_ERROR then
81           RAISE FND_API.G_EXC_ERROR;
82       elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
83           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
84       END IF;
85       --
86       -- End of API body.
87       --
88 
89       -- Debug Message
90       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'end');
91 
92 EXCEPTION
93 
94    WHEN AMS_Utility_PVT.resource_locked THEN
95      x_return_status := FND_API.g_ret_sts_error;
96      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
97         FND_MESSAGE.set_name('AMS', 'AMS_API_RESOURCE_LOCKED');
98         FND_MSG_PUB.add;
99      END IF;
100 
101    WHEN FND_API.G_EXC_ERROR THEN
102      ROLLBACK TO LOCK_Dmlift_PUB;
103      x_return_status := FND_API.G_RET_STS_ERROR;
104      -- Standard call to get message count and if count=1, get the message
105      FND_MSG_PUB.Count_And_Get (
106             p_encoded => FND_API.G_FALSE,
107             p_count   => x_msg_count,
108             p_data    => x_msg_data
109      );
110 
111    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
112      ROLLBACK TO LOCK_Dmlift_PUB;
113      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
114      -- Standard call to get message count and if count=1, get the message
115      FND_MSG_PUB.Count_And_Get (
116             p_encoded => FND_API.G_FALSE,
117             p_count => x_msg_count,
118             p_data  => x_msg_data
119      );
120 
121    WHEN OTHERS THEN
122      ROLLBACK TO LOCK_Dmlift_PUB;
123      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
124      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
125      THEN
126         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
127      END IF;
128      -- Standard call to get message count and if count=1, get the message
129      FND_MSG_PUB.Count_And_Get (
130             p_encoded => FND_API.G_FALSE,
131             p_count => x_msg_count,
132             p_data  => x_msg_data
133      );
134 End Lock_Dmlift;
135 
136 
137 PROCEDURE Create_Lift(
138     p_api_version    IN   NUMBER,
139     p_init_msg_list  IN   VARCHAR2     := FND_API.G_FALSE,
140     p_commit         IN   VARCHAR2     := FND_API.G_FALSE,
141 
142     x_return_status  OUT  VARCHAR2,
143     x_msg_count      OUT  NUMBER,
144     x_msg_data       OUT  VARCHAR2,
145 
146     p_lift_rec       IN   Lift_rec_type  := g_miss_Lift_rec,
147     x_lift_id        OUT  NUMBER
148      )
149 
150 IS
151    L_API_NAME                 CONSTANT VARCHAR2(30) := 'Create_Lift';
152    L_API_VERSION_NUMBER       CONSTANT NUMBER   := 1.0;
153    l_pvt_Lift_rec             AMS_DMLift_PVT.Lift_rec_type;
154 BEGIN
155       -- Standard Start of API savepoint
156       SAVEPOINT Create_Lift_PUB;
157 
158       -- Standard call to check for call compatibility.
159       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
160                                            p_api_version,
161                                            l_api_name,
162                                            G_PKG_NAME)
163       THEN
164           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
165       END IF;
166 
167       -- Initialize message list if p_init_msg_list is set to TRUE.
168       IF FND_API.to_Boolean( p_init_msg_list )
169       THEN
170          FND_MSG_PUB.initialize;
171       END IF;
172 
173       -- Debug Message
174       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'start');
175 
176 
177       -- Initialize API return status to SUCCESS
178       x_return_status := FND_API.G_RET_STS_SUCCESS;
179 
180       --
181       -- API body
182       --
183       -- l_pvt_lift_rec declared from the private API
184       -- rec type and p_lift_rec declared from public
185       -- API rec type.
186       l_pvt_lift_rec.model_id := p_lift_rec.model_id;
187       l_pvt_lift_rec.quantile := p_lift_rec.quantile;
188       l_pvt_lift_rec.lift := p_lift_rec.lift;
189       l_pvt_lift_rec.targets := p_lift_rec.targets;
190       l_pvt_lift_rec.non_targets := p_lift_rec.non_targets;
191       l_pvt_lift_rec.targets_cumm := p_lift_rec.targets_cumm;
192       l_pvt_lift_rec.target_density := p_lift_rec.target_density;
193       l_pvt_lift_rec.target_density_cumm := p_lift_rec.target_density_cumm;
194       l_pvt_lift_rec.target_confidence := p_lift_rec.target_confidence;
195       l_pvt_lift_rec.non_target_confidence := p_lift_rec.non_target_confidence;
196 
197     -- Calling Private package: Create_Lift
198     -- Hint: Primary key needs to be returned
199      AMS_DMLift_PVT.Create_Lift(
200         p_api_version         => 1.0,
201         p_init_msg_list       => FND_API.G_FALSE,
202         p_commit              => FND_API.G_FALSE,
203         p_validation_level    => FND_API.G_VALID_LEVEL_FULL,
204         x_return_status       => x_return_status,
205         x_msg_count           => x_msg_count,
206         x_msg_data            => x_msg_data,
207         p_lift_rec            => l_pvt_lift_rec,
208         x_lift_id             => x_lift_id);
209 
210 
211       -- Check return status from the above procedure call
212       IF x_return_status = FND_API.G_RET_STS_ERROR then
213           RAISE FND_API.G_EXC_ERROR;
214       elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
215           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
216       END IF;
217       --
218       -- End of API body.
219       --
220 
221       -- Standard check for p_commit
222       IF FND_API.to_Boolean( p_commit )
223       THEN
224          COMMIT WORK;
225       END IF;
226 
227 
228       -- Debug Message
229       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'end');
230 
231       -- Standard call to get message count and if count is 1, get message info.
232       FND_MSG_PUB.Count_And_Get
233         (p_count          =>   x_msg_count,
234          p_data           =>   x_msg_data
235       );
236 EXCEPTION
237 
238    WHEN AMS_Utility_PVT.resource_locked THEN
239      x_return_status := FND_API.g_ret_sts_error;
240      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
241         FND_MESSAGE.set_name('AMS', 'AMS_API_RESOURCE_LOCKED');
242         FND_MSG_PUB.add;
243      END IF;
244 
245    WHEN FND_API.G_EXC_ERROR THEN
246      ROLLBACK TO Create_Lift_PUB;
247      x_return_status := FND_API.G_RET_STS_ERROR;
248      -- Standard call to get message count and if count=1, get the message
249      FND_MSG_PUB.Count_And_Get (
250             p_encoded => FND_API.G_FALSE,
251             p_count   => x_msg_count,
252             p_data    => x_msg_data
253      );
254 
255    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
256      ROLLBACK TO Create_Lift_PUB;
257      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
258      -- Standard call to get message count and if count=1, get the message
259      FND_MSG_PUB.Count_And_Get (
260             p_encoded => FND_API.G_FALSE,
261             p_count => x_msg_count,
262             p_data  => x_msg_data
263      );
264 
265    WHEN OTHERS THEN
266      ROLLBACK TO Create_Lift_PUB;
267      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
268      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
269      THEN
270         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
271      END IF;
272      -- Standard call to get message count and if count=1, get the message
273      FND_MSG_PUB.Count_And_Get (
274             p_encoded => FND_API.G_FALSE,
275             p_count => x_msg_count,
276             p_data  => x_msg_data
277      );
278 End Create_Lift;
279 
280 
281 PROCEDURE Update_Lift(
282     p_api_version         IN   NUMBER,
283     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
284     p_commit                     IN   VARCHAR2     := FND_API.G_FALSE,
285 
286     x_return_status              OUT  VARCHAR2,
287     x_msg_count                  OUT  NUMBER,
288     x_msg_data                   OUT  VARCHAR2,
289 
290     p_lift_rec               IN    lift_rec_type,
291     x_object_version_number      OUT  NUMBER
292     )
293 
294 IS
295    L_API_NAME                  CONSTANT VARCHAR2(30) := 'Update_Lift';
296    L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
297    l_object_version_number  NUMBER;
298    l_pvt_Lift_rec  AMS_DMLift_PVT.Lift_rec_type;
299 BEGIN
300       -- Standard Start of API savepoint
301       SAVEPOINT Update_Lift_PUB;
302 
303       -- Standard call to check for call compatibility.
304       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
305                                            p_api_version,
306                                            l_api_name,
307                                            G_PKG_NAME)
308       THEN
309           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
310       END IF;
311 
312       -- Initialize message list if p_init_msg_list is set to TRUE.
313       IF FND_API.to_Boolean( p_init_msg_list )
314       THEN
315          FND_MSG_PUB.initialize;
316       END IF;
317 
318       -- Debug Message
319       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'start');
320 
321 
322       -- Initialize API return status to SUCCESS
323       x_return_status := FND_API.G_RET_STS_SUCCESS;
324 
325       --
326       -- API body
327       --
328     AMS_DMLift_PVT.Update_Lift(
329     p_api_version         => 1.0,
330     p_init_msg_list              => FND_API.G_FALSE,
331     p_commit                     => p_commit,
332     p_validation_level           => FND_API.G_VALID_LEVEL_FULL,
333     x_return_status              => x_return_status,
334     x_msg_count                  => x_msg_count,
335     x_msg_data                   => x_msg_data,
336     p_lift_rec  =>  l_pvt_lift_rec,
337     x_object_version_number      => l_object_version_number );
338 
339 
340       -- Check return status from the above procedure call
341       IF x_return_status = FND_API.G_RET_STS_ERROR then
342           RAISE FND_API.G_EXC_ERROR;
343       elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
344           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
345       END IF;
346       --
347       -- End of API body
348       --
349 
350       -- Standard check for p_commit
351       IF FND_API.to_Boolean( p_commit )
352       THEN
353          COMMIT WORK;
354       END IF;
355 
356 
357       -- Debug Message
358       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'end');
359 
360       -- Standard call to get message count and if count is 1, get message info.
361       FND_MSG_PUB.Count_And_Get
362         (p_count          =>   x_msg_count,
363          p_data           =>   x_msg_data
364       );
365 EXCEPTION
366 
367    WHEN AMS_Utility_PVT.resource_locked THEN
368      x_return_status := FND_API.g_ret_sts_error;
369      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
370         FND_MESSAGE.set_name('AMS', 'AMS_API_RESOURCE_LOCKED');
371         FND_MSG_PUB.add;
372      END IF;
373 
374    WHEN FND_API.G_EXC_ERROR THEN
375      ROLLBACK TO Update_Lift_PUB;
376      x_return_status := FND_API.G_RET_STS_ERROR;
377      -- Standard call to get message count and if count=1, get the message
378      FND_MSG_PUB.Count_And_Get (
379             p_encoded => FND_API.G_FALSE,
380             p_count   => x_msg_count,
381             p_data    => x_msg_data
382      );
383 
384    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
385      ROLLBACK TO Update_Lift_PUB;
386      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
387      -- Standard call to get message count and if count=1, get the message
388      FND_MSG_PUB.Count_And_Get (
389             p_encoded => FND_API.G_FALSE,
390             p_count => x_msg_count,
391             p_data  => x_msg_data
392      );
393 
394    WHEN OTHERS THEN
395      ROLLBACK TO Update_Lift_PUB;
396      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
397      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
398      THEN
399         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
400      END IF;
401      -- Standard call to get message count and if count=1, get the message
402      FND_MSG_PUB.Count_And_Get (
403             p_encoded => FND_API.G_FALSE,
404             p_count => x_msg_count,
405             p_data  => x_msg_data
406      );
407 End Update_Lift;
408 
409 
410 PROCEDURE Delete_Lift(
411     p_api_version         IN   NUMBER,
412     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
413     p_commit                     IN   VARCHAR2     := FND_API.G_FALSE,
414     x_return_status              OUT  VARCHAR2,
415     x_msg_count                  OUT  NUMBER,
416     x_msg_data                   OUT  VARCHAR2,
417     p_lift_id                   IN  NUMBER,
418     p_object_version_number      IN   NUMBER
419     )
420 
424    l_LIFT_ID  NUMBER := p_LIFT_ID;
421 IS
422    L_API_NAME                  CONSTANT VARCHAR2(30) := 'Delete_Lift';
423    L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
425    l_object_version_number  NUMBER := p_object_version_number;
426    l_pvt_Lift_rec  AMS_DMLift_PVT.Lift_rec_type;
427 BEGIN
428       -- Standard Start of API savepoint
429       SAVEPOINT Delete_Lift_PUB;
430 
431       -- Standard call to check for call compatibility.
432       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
433                                            p_api_version,
434                                            l_api_name,
435                                            G_PKG_NAME)
436       THEN
437           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
438       END IF;
439 
440       -- Initialize message list if p_init_msg_list is set to TRUE.
441       IF FND_API.to_Boolean( p_init_msg_list )
442       THEN
443          FND_MSG_PUB.initialize;
444       END IF;
445 
446       -- Debug Message
447       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'start');
448 
449 
450       -- Initialize API return status to SUCCESS
451       x_return_status := FND_API.G_RET_STS_SUCCESS;
452 
453       --
454       -- API body
455       --
456     AMS_DMLift_PVT.Delete_Lift(
457     p_api_version         => 1.0,
458     p_init_msg_list              => FND_API.G_FALSE,
459     p_commit                     => p_commit,
460     p_validation_level           => FND_API.G_VALID_LEVEL_FULL,
461     x_return_status              => x_return_status,
462     x_msg_count                  => x_msg_count,
463     x_msg_data                   => x_msg_data,
464     p_lift_id     => l_lift_id,
465     p_object_version_number      => l_object_version_number );
466 
467 
468       -- Check return status from the above procedure call
469       IF x_return_status = FND_API.G_RET_STS_ERROR then
470           RAISE FND_API.G_EXC_ERROR;
471       elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
472           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
473       END IF;
474       --
475       -- End of API body
476       --
477 
478       -- Standard check for p_commit
479       IF FND_API.to_Boolean( p_commit )
480       THEN
481          COMMIT WORK;
482       END IF;
483 
484 
485       -- Debug Message
486       AMS_UTILITY_PVT.debug_message('Public API: ' || l_api_name || 'end');
487 
488       -- Standard call to get message count and if count is 1, get message info.
489       FND_MSG_PUB.Count_And_Get
490         (p_count          =>   x_msg_count,
491          p_data           =>   x_msg_data
492       );
493 EXCEPTION
494 
495    WHEN AMS_Utility_PVT.resource_locked THEN
496      x_return_status := FND_API.g_ret_sts_error;
497      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
498         FND_MESSAGE.set_name('AMS', 'AMS_API_RESOURCE_LOCKED');
499         FND_MSG_PUB.add;
500      END IF;
501 
502    WHEN FND_API.G_EXC_ERROR THEN
503      ROLLBACK TO Delete_Lift_PUB;
504      x_return_status := FND_API.G_RET_STS_ERROR;
505      -- Standard call to get message count and if count=1, get the message
506      FND_MSG_PUB.Count_And_Get (
507             p_encoded => FND_API.G_FALSE,
508             p_count   => x_msg_count,
509             p_data    => x_msg_data
510      );
511 
512    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
513      ROLLBACK TO Delete_Lift_PUB;
514      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
515      -- Standard call to get message count and if count=1, get the message
516      FND_MSG_PUB.Count_And_Get (
517             p_encoded => FND_API.G_FALSE,
518             p_count => x_msg_count,
519             p_data  => x_msg_data
520      );
521 
522    WHEN OTHERS THEN
523      ROLLBACK TO Delete_Lift_PUB;
524      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
525      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
526      THEN
527         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
528      END IF;
529      -- Standard call to get message count and if count=1, get the message
530      FND_MSG_PUB.Count_And_Get (
531             p_encoded => FND_API.G_FALSE,
532             p_count => x_msg_count,
533             p_data  => x_msg_data
534      );
535 End Delete_Lift;
536 
537 
538 PROCEDURE Create_Lift (
539    p_model_id        IN NUMBER,
540    p_quantile        IN NUMBER,
541    p_lift            IN NUMBER,
542    p_targets         IN NUMBER,
543    p_non_targets     IN NUMBER,
544    p_targets_cumm    IN NUMBER,
545    p_target_density  IN NUMBER,
546    p_target_density_cumm IN NUMBER,
547    p_target_confidence  IN NUMBER,
548    p_non_target_confidence IN NUMBER,
549    x_lift_id         OUT NUMBER,
550    x_return_status   OUT VARCHAR2
551 )
552 IS
553    L_API_NAME           CONSTANT VARCHAR2(30) := 'Create_Lift';
554    L_API_VERSION        CONSTANT NUMBER := 1.0;
555 
556    l_lift_rec           AMS_DMLift_PVT.Lift_Rec_Type;
557    l_lift_id               NUMBER;
558    l_object_version_number NUMBER := 1;
559 
560    l_msg_count          NUMBER;
561    l_msg_data           VARCHAR2(4000);
562 
563    l_dummy     NUMBER;
564 
565    CURSOR c_lift_id IS
566       SELECT ams_dm_lift_s.NEXTVAL
567       FROM   dual;
568 
569    CURSOR c_id_exists (p_lift_id IN NUMBER) IS
570       SELECT 1
571       FROM   dual
572       WHERE  EXISTS (SELECT 1
573                      FROM   ams_dm_lift
574                      WHERE  lift_id = p_lift_id)
575       ;
576 BEGIN
580    -- Construct the record for the private API
577    -- Initialize return status
578    x_return_status := FND_API.g_ret_sts_success;
579 
581    l_lift_rec.model_id := p_model_id;
582    l_lift_rec.quantile := p_quantile;
583    l_lift_rec.lift := p_lift;
584    l_lift_rec.targets := p_targets;
585    l_lift_rec.non_targets := p_non_targets;
586    l_lift_rec.targets_cumm := p_targets_cumm;
587    l_lift_rec.target_density := p_target_density;
588    l_lift_rec.target_density_cumm := p_target_density_cumm;
589    l_lift_rec.target_confidence := p_target_confidence;
590    l_lift_rec.non_target_confidence := p_non_target_confidence;
591 
592 
593    -- validate input
594    AMS_DMLift_PVT.validate_lift (
595       p_api_version        => 1.0,
596       p_init_msg_list      => FND_API.g_true,
597       p_validation_level   => FND_API.g_valid_level_full,
598       p_validation_mode    => JTF_PLSQL_API.G_UPDATE,
599       p_lift_rec           => l_lift_rec,
600       x_return_status      => x_return_status,
601       x_msg_count          => l_msg_count,
602       x_msg_data           => l_msg_data
603    );
604    -- Check return status from the above procedure call
605    IF x_return_status = FND_API.G_RET_STS_ERROR THEN
606       RAISE FND_API.G_EXC_ERROR;
607    ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
608       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
609    END IF;
610 
611    -- get unique id
612    LOOP
613       l_dummy := NULL;
614 
615       OPEN c_lift_id;
616       FETCH c_lift_id INTO l_lift_id;
617       CLOSE c_lift_id;
618 
619       OPEN c_id_exists (l_lift_id);
620       FETCH c_id_exists INTO l_dummy;
621       CLOSE c_id_exists;
622 
623       EXIT WHEN l_dummy IS NULL;
624    END LOOP;
625 
626    -- Call the table handler.
627    -- Note: margin and roi are not used.
628    ams_dm_lift_pkg.Insert_Row(
629       px_LIFT_ID           => l_lift_id,
630       p_LAST_UPDATE_DATE   => SYSDATE,
631       p_LAST_UPDATED_BY    => FND_GLOBAL.user_id,
632       p_CREATION_DATE      => SYSDATE,
633       p_CREATED_BY         => FND_GLOBAL.user_id,
634       p_LAST_UPDATE_LOGIN  => FND_GLOBAL.conc_login_id,
635       px_OBJECT_VERSION_NUMBER   => l_object_version_number,
636       p_MODEL_ID           => p_model_id,
637       p_QUANTILE           => p_quantile,
638       p_LIFT               =>p_lift,
639       p_TARGETS            => p_targets,
640       p_NON_TARGETS        => p_non_targets,
641       p_TARGETS_CUMM       => p_targets_cumm,
642       p_TARGET_DENSITY_CUMM   => p_target_density_cumm,
643       p_TARGET_DENSITY     => p_target_density,
644       p_MARGIN             => NULL,
645       p_ROI                => NULL,
646       p_TARGET_CONFIDENCE  => p_target_confidence,
647       p_NON_TARGET_CONFIDENCE => p_non_target_confidence
648    );
649 EXCEPTION
650    WHEN FND_API.G_EXC_ERROR THEN
651      x_return_status := FND_API.G_RET_STS_ERROR;
652    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
653      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
654    WHEN OTHERS THEN
655      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
656      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
657         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
658      END IF;
659 END;
660 
661 
662 END AMS_Dmlift_PUB;