DBA Data[Home] [Help]

PACKAGE BODY: APPS.AMS_DMPERFORMANCE_PUB

Source


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