DBA Data[Home] [Help]

PACKAGE BODY: APPS.CN_CREDIT_CONV_FCTS_PKG

Source


1 package body CN_CREDIT_CONV_FCTS_PKG as
2 /* $Header: cncrtcvb.pls 115.2 2001/10/29 17:06:15 pkm ship    $ */
3 
4   PROCEDURE Insert_Row
5       ( x_credit_conv_fct_id  NUMBER			,
6     	x_from_credit_type_id NUMBER			,
7    	x_to_credit_type_id   NUMBER			,
8         x_conversion_factor   NUMBER			,
9     	x_start_date          DATE			,
10     	x_end_date            DATE			,
11     	x_attribute_category  VARCHAR2 := NULL		,
12     	x_attribute1          VARCHAR2 := NULL		,
13     	x_attribute2          VARCHAR2 := NULL		,
14     	x_attribute3          VARCHAR2 := NULL		,
15     	x_attribute4          VARCHAR2 := NULL		,
16     	x_attribute5          VARCHAR2 := NULL		,
17     	x_attribute6          VARCHAR2 := NULL		,
18     	x_attribute7          VARCHAR2 := NULL		,
19     	x_attribute8          VARCHAR2 := NULL		,
20     	x_attribute9          VARCHAR2 := NULL		,
21     	x_attribute10         VARCHAR2 := NULL		,
22     	x_attribute11         VARCHAR2 := NULL		,
23     	x_attribute12         VARCHAR2 := NULL		,
24     	x_attribute13         VARCHAR2 := NULL		,
25     	x_attribute14         VARCHAR2 := NULL		,
26         x_attribute15         VARCHAR2 := NULL		,
27         x_created_by	      NUMBER			,
28         x_creation_date	      DATE			,
29         x_last_update_login   NUMBER			,
30         x_last_update_date    DATE			,
31         x_last_updated_by     NUMBER
32       ) IS
33   BEGIN
34     INSERT INTO cn_credit_conv_fcts
35       ( object_version_number,
36         credit_conv_fct_id,
37         from_credit_type_id,
38         to_credit_type_id,
39         conversion_factor,
40         start_date,
41         end_date,
42 	attribute_category,
43     	attribute1,
44     	attribute2,
45     	attribute3,
46     	attribute4,
47     	attribute5,
48     	attribute6,
49     	attribute7,
50        	attribute8,
51     	attribute9,
52     	attribute10,
53     	attribute11,
54     	attribute12,
55     	attribute13,
56     	attribute14,
57         attribute15,
58         created_by,
59         creation_date,
60         last_update_login,
61         last_update_date,
62         last_updated_by
63       ) VALUES
64       (   1.0,
65           x_credit_conv_fct_id,
66           x_from_credit_type_id,
67           x_to_credit_type_id,
68           x_conversion_factor,
69           x_start_date,
70           x_end_date,
71           x_attribute_category,
72     	  x_attribute1,
73     	  x_attribute2,
74     	  x_attribute3,
75     	  x_attribute4,
76     	  x_attribute5,
77     	  x_attribute6,
78     	  x_attribute7,
79        	  x_attribute8,
80     	  x_attribute9,
81     	  x_attribute10,
82     	  x_attribute11,
83     	  x_attribute12,
84     	  x_attribute13,
85     	  x_attribute14,
86           x_attribute15,
87           x_created_by,
88           x_creation_date,
89           x_last_update_login,
90           x_last_update_date,
91           x_last_updated_by
92         );
93   END Insert_Row;
94 
95 
96   PROCEDURE Update_Row
97     ( x_credit_conv_fct_id  NUMBER			,
98       x_object_version      number,
99     	x_from_credit_type_id NUMBER			,
100    	x_to_credit_type_id   NUMBER			,
101         x_conversion_factor   NUMBER			,
102     	x_start_date          DATE			,
103     	x_end_date            DATE			,
104     	x_attribute_category  VARCHAR2 := NULL		,
105     	x_attribute1          VARCHAR2 := NULL		,
106     	x_attribute2          VARCHAR2 := NULL		,
107     	x_attribute3          VARCHAR2 := NULL		,
108     	x_attribute4          VARCHAR2 := NULL		,
109     	x_attribute5          VARCHAR2 := NULL		,
110     	x_attribute6          VARCHAR2 := NULL		,
111     	x_attribute7          VARCHAR2 := NULL		,
112     	x_attribute8          VARCHAR2 := NULL		,
113     	x_attribute9          VARCHAR2 := NULL		,
114     	x_attribute10         VARCHAR2 := NULL		,
115     	x_attribute11         VARCHAR2 := NULL		,
116     	x_attribute12         VARCHAR2 := NULL		,
117     	x_attribute13         VARCHAR2 := NULL		,
118     	x_attribute14         VARCHAR2 := NULL		,
119         x_attribute15         VARCHAR2 := NULL		,
120         x_created_by	      NUMBER			,
121         x_creation_date	      DATE			,
122         x_last_update_login   NUMBER			,
123         x_last_update_date    DATE			,
124         x_last_updated_by     NUMBER
125       ) IS
126   BEGIN
127     UPDATE cn_credit_conv_fcts
128       SET
129         object_version_number = x_object_version +1,
130         from_credit_type_id = x_from_credit_type_id,
131         to_credit_type_id   = x_to_credit_type_id,
132         conversion_factor   = x_conversion_factor,
133         start_date          = x_start_date,
134         end_date            = x_end_date,
135         attribute_category  = x_attribute_category,
136     	attribute1          = x_attribute1,
137     	attribute2          = x_attribute2,
138     	attribute3          = x_attribute3,
139     	attribute4          = x_attribute4,
140     	attribute5          = x_attribute5,
141     	attribute6          = x_attribute6,
142     	attribute7          = x_attribute7,
143        	attribute8          = x_attribute8,
144     	attribute9          = x_attribute9,
145     	attribute10         = x_attribute10,
146     	attribute11         = x_attribute11,
147     	attribute12         = x_attribute12,
148     	attribute13         = x_attribute13,
149     	attribute14         = x_attribute14,
150         attribute15         = x_attribute15,
151         created_by          = x_created_by,
152         creation_date       = x_creation_date,
153         last_update_login   = x_last_update_login,
154         last_update_date    = x_last_update_date,
155         last_updated_by     = x_last_updated_by
156     WHERE credit_conv_fct_id = x_credit_conv_fct_id;
157     IF (SQL%NOTFOUND) THEN
158       Raise NO_DATA_FOUND;
159     END IF;
160   END Update_Row;
161 
162   PROCEDURE Lock_Row
163       ( x_credit_conv_fct_id  NUMBER			,
164     	x_from_credit_type_id NUMBER			,
165    	x_to_credit_type_id   NUMBER			,
166         x_conversion_factor   NUMBER			,
167     	x_start_date          DATE			,
168     	x_end_date            DATE			,
169     	x_attribute_category  VARCHAR2 := NULL		,
170     	x_attribute1          VARCHAR2 := NULL		,
171     	x_attribute2          VARCHAR2 := NULL		,
172     	x_attribute3          VARCHAR2 := NULL		,
173     	x_attribute4          VARCHAR2 := NULL		,
174     	x_attribute5          VARCHAR2 := NULL		,
175     	x_attribute6          VARCHAR2 := NULL		,
176     	x_attribute7          VARCHAR2 := NULL		,
177     	x_attribute8          VARCHAR2 := NULL		,
178     	x_attribute9          VARCHAR2 := NULL		,
179     	x_attribute10         VARCHAR2 := NULL		,
180     	x_attribute11         VARCHAR2 := NULL		,
181     	x_attribute12         VARCHAR2 := NULL		,
182     	x_attribute13         VARCHAR2 := NULL		,
183     	x_attribute14         VARCHAR2 := NULL		,
184         x_attribute15         VARCHAR2 := NULL		,
185         x_created_by	      NUMBER			,
186         x_creation_date	      DATE			,
187         x_last_update_login   NUMBER			,
188         x_last_update_date    DATE			,
189         x_last_updated_by     NUMBER
190       ) IS
191     CURSOR C IS
192        SELECT *
193        FROM cn_credit_conv_fcts
194        WHERE credit_conv_fct_id = x_credit_conv_fct_id
195        FOR UPDATE of credit_conv_fct_id NOWAIT;
196     Recinfo C%ROWTYPE;
197   BEGIN
198     OPEN C;
199     FETCH C INTO Recinfo;
200     IF (C%NOTFOUND) THEN
201       CLOSE C;
202       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
203       APP_EXCEPTION.Raise_Exception;
204     END IF;
205     CLOSE C;
206 
207     if (
208     --  check that mandatory columns match values in form
209         (Recinfo.credit_conv_fct_id = x_credit_conv_fct_id)
210         AND (Recinfo.last_update_date = x_last_update_date)
211         AND (Recinfo.last_updated_by = x_last_updated_by)
212         AND (Recinfo.creation_date = x_creation_date)
213         AND (Recinfo.created_by = x_created_by)
214         AND (Recinfo.last_update_login = x_last_update_login)
215         AND (Recinfo.from_credit_type_id = x_from_credit_type_id)
216         AND (Recinfo.to_credit_type_id = x_to_credit_type_id)
217         AND (Recinfo.conversion_factor = x_conversion_factor)
218         AND (Recinfo.start_date = x_start_date)
219 
220     --  check that non-mandatory columns match values in form
221         AND ((Recinfo.end_date = x_end_date)
222              OR ((Recinfo.end_date is null)
223                  AND (x_end_date is null)))
224 
225         AND ((Recinfo.attribute_category = x_attribute_category)
226              OR ((Recinfo.attribute_category is null)
227                  AND (x_attribute_category is null)))
228 
229         AND ((Recinfo.attribute1 = x_attribute1)
230              OR ((Recinfo.attribute1 is null)
231                  AND (x_attribute1 is null)))
232 
233         AND ((Recinfo.attribute2 = x_attribute2)
234              OR ((Recinfo.attribute2 is null)
235                  AND (x_attribute2 is null)))
236 
237         AND ((Recinfo.attribute3 = x_attribute3)
238              OR ((Recinfo.attribute3 is null)
239                  AND (x_attribute3 is null)))
240 
241         AND ((Recinfo.attribute4 = x_attribute4)
242              OR ((Recinfo.attribute4 is null)
243                  AND (x_attribute4 is null)))
244 
245         AND ((Recinfo.attribute5 = x_attribute5)
246              OR ((Recinfo.attribute5 is null)
247                  AND (x_attribute5 is null)))
248 
249         AND ((Recinfo.attribute6 = x_attribute6)
250              OR ((Recinfo.attribute6 is null)
251                  AND (x_attribute6 is null)))
252 
253         AND ((Recinfo.attribute7 = x_attribute7)
254              OR ((Recinfo.attribute7 is null)
255                  AND (x_attribute7 is null)))
256 
257         AND ((Recinfo.attribute8 = x_attribute8)
258              OR ((Recinfo.attribute8 is null)
259                  AND (x_attribute8 is null)))
260 
261         AND ((Recinfo.attribute9 = x_attribute9)
262              OR ((Recinfo.attribute9 is null)
263                  AND (x_attribute9 is null)))
264 
265         AND ((Recinfo.attribute10 = x_attribute10)
266              OR ((Recinfo.attribute10 is null)
267                  AND (x_attribute10 is null)))
268 
269         AND ((Recinfo.attribute11 = x_attribute11)
270              OR ((Recinfo.attribute11 is null)
271                  AND (x_attribute11 is null)))
272 
273         AND ((Recinfo.attribute12 = x_attribute12)
274              OR ((Recinfo.attribute12 is null)
275                  AND (x_attribute12 is null)))
276 
277         AND ((Recinfo.attribute13 = x_attribute13)
278              OR ((Recinfo.attribute13 is null)
279                  AND (x_attribute13 is null)))
280 
281         AND ((Recinfo.attribute14 = x_attribute14)
282              OR ((Recinfo.attribute14 is null)
283                  AND (x_attribute14 is null)))
284 
285         AND ((Recinfo.attribute15 = x_attribute15)
286              OR ((Recinfo.attribute15 is null)
287                  AND (x_attribute15 is null)))
288     ) then
289     return;
290     else
291       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
292       app_exception.Raise_Exception;
293     end if;
294   END Lock_Row;
295 
296   PROCEDURE Delete_Row(x_credit_conv_fct_id  NUMBER) IS
297   BEGIN
298     DELETE FROM CN_CREDIT_CONV_FCTS
299     WHERE credit_conv_fct_id = x_credit_conv_fct_id;
300     IF (SQL%NOTFOUND) THEN
301       Raise NO_DATA_FOUND;
302     END IF;
303   END Delete_Row;
304 
305 end CN_CREDIT_CONV_FCTS_PKG;