DBA Data[Home] [Help]

PACKAGE BODY: APPS.CST_DEPARTMENT_OVERHEADS_PKG

Source


1 PACKAGE BODY CST_DEPARTMENT_OVERHEADS_PKG as
2 /* $Header: cstpcdob.pls 115.3 2002/11/11 23:20:11 awwang ship $ */
3 
4   PROCEDURE Insert_Row(X_Rowid                   IN OUT NOCOPY VARCHAR2,
5                        X_Department_Id                  NUMBER,
6                        X_Cost_Type_Id                   NUMBER,
7                        X_Overhead_Id                    NUMBER,
8                        X_Last_Update_Date               DATE,
9                        X_Last_Updated_By                NUMBER,
10                        X_Creation_Date                  DATE,
11                        X_Created_By                     NUMBER,
12                        X_Last_Update_Login              NUMBER DEFAULT NULL,
13                        X_Organization_Id                NUMBER,
14                        X_Basis_Type                     NUMBER,
15                        X_Rate_Or_Amount                 NUMBER,
16                        X_Activity_Id                    NUMBER DEFAULT NULL,
17                        X_Attribute_Category             VARCHAR2 DEFAULT NULL,
18                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
19                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
20                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
21                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
22                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
23                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
24                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
25                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
26                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
27                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
28                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
29                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
30                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
31                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
32                        X_Attribute15                    VARCHAR2 DEFAULT NULL
33 
34    ) IS
35      CURSOR C IS SELECT rowid FROM CST_DEPARTMENT_OVERHEADS
36                  WHERE cost_type_id = X_Cost_Type_Id
37 
38                  AND   department_id = X_Department_Id
39 
40                  AND   overhead_id = X_Overhead_Id;
41 
42 
43 
44     BEGIN
45 
46 
47        INSERT INTO CST_DEPARTMENT_OVERHEADS(
48                department_id,
49                cost_type_id,
50                overhead_id,
51                last_update_date,
52                last_updated_by,
53                creation_date,
54                created_by,
55                last_update_login,
56                organization_id,
57                basis_type,
58                rate_or_amount,
59                activity_id,
60                attribute_category,
61                attribute1,
62                attribute2,
63                attribute3,
64                attribute4,
65                attribute5,
66                attribute6,
67                attribute7,
68                attribute8,
69                attribute9,
70                attribute10,
71                attribute11,
72                attribute12,
73                attribute13,
74                attribute14,
75                attribute15
76              ) VALUES (
77                X_Department_Id,
78                X_Cost_Type_Id,
79                X_Overhead_Id,
80                X_Last_Update_Date,
81                X_Last_Updated_By,
82                X_Creation_Date,
83                X_Created_By,
84                X_Last_Update_Login,
85                X_Organization_Id,
86                X_Basis_Type,
87                X_Rate_Or_Amount,
88                X_Activity_Id,
89                X_Attribute_Category,
90                X_Attribute1,
91                X_Attribute2,
92                X_Attribute3,
93                X_Attribute4,
94                X_Attribute5,
95                X_Attribute6,
96                X_Attribute7,
97                X_Attribute8,
98                X_Attribute9,
99                X_Attribute10,
100                X_Attribute11,
101                X_Attribute12,
102                X_Attribute13,
103                X_Attribute14,
104                X_Attribute15
105              );
106 
107     OPEN C;
108     FETCH C INTO X_Rowid;
109     if (C%NOTFOUND) then
110       CLOSE C;
111       Raise NO_DATA_FOUND;
112     end if;
113     CLOSE C;
114   END Insert_Row;
115 
116 
117 
118   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
119                      X_Department_Id                    NUMBER,
120                      X_Cost_Type_Id                     NUMBER,
121                      X_Overhead_Id                      NUMBER,
122                      X_Organization_Id                  NUMBER,
123                      X_Basis_Type                       NUMBER,
124                      X_Rate_Or_Amount                   NUMBER,
125                      X_Activity_Id                      NUMBER DEFAULT NULL,
126                      X_Attribute_Category               VARCHAR2 DEFAULT NULL,
127                      X_Attribute1                       VARCHAR2 DEFAULT NULL,
128                      X_Attribute2                       VARCHAR2 DEFAULT NULL,
129                      X_Attribute3                       VARCHAR2 DEFAULT NULL,
130                      X_Attribute4                       VARCHAR2 DEFAULT NULL,
131                      X_Attribute5                       VARCHAR2 DEFAULT NULL,
132                      X_Attribute6                       VARCHAR2 DEFAULT NULL,
133                      X_Attribute7                       VARCHAR2 DEFAULT NULL,
134                      X_Attribute8                       VARCHAR2 DEFAULT NULL,
135                      X_Attribute9                       VARCHAR2 DEFAULT NULL,
136                      X_Attribute10                      VARCHAR2 DEFAULT NULL,
137                      X_Attribute11                      VARCHAR2 DEFAULT NULL,
138                      X_Attribute12                      VARCHAR2 DEFAULT NULL,
139                      X_Attribute13                      VARCHAR2 DEFAULT NULL,
140                      X_Attribute14                      VARCHAR2 DEFAULT NULL,
141                      X_Attribute15                      VARCHAR2 DEFAULT NULL
142 
143   ) IS
144     CURSOR C IS
145         SELECT *
146         FROM   CST_DEPARTMENT_OVERHEADS
147         WHERE  rowid = X_Rowid
148         FOR UPDATE of Cost_Type_Id NOWAIT;
149     Recinfo C%ROWTYPE;
150   BEGIN
151     OPEN C;
152     FETCH C INTO Recinfo;
153     if (C%NOTFOUND) then
154       CLOSE C;
155       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
156       APP_EXCEPTION.Raise_Exception;
157     end if;
158     CLOSE C;
159     if (
160 
161                (Recinfo.department_id = X_Department_Id)
162            AND (Recinfo.cost_type_id = X_Cost_Type_Id)
163            AND (Recinfo.overhead_id = X_Overhead_Id)
164            AND (Recinfo.organization_id = X_Organization_Id)
165            AND (Recinfo.basis_type = X_Basis_Type)
166            AND (Recinfo.rate_or_amount = X_Rate_Or_Amount)
167            AND (   (Recinfo.activity_id = X_Activity_Id)
168                 OR (    (Recinfo.activity_id IS NULL)
169                     AND (X_Activity_Id IS NULL)))
170            AND (   (Recinfo.attribute_category = X_Attribute_Category)
171                 OR (    (Recinfo.attribute_category IS NULL)
172                     AND (X_Attribute_Category IS NULL)))
173            AND (   (Recinfo.attribute1 = X_Attribute1)
174                 OR (    (Recinfo.attribute1 IS NULL)
175                     AND (X_Attribute1 IS NULL)))
176            AND (   (Recinfo.attribute2 = X_Attribute2)
177                 OR (    (Recinfo.attribute2 IS NULL)
178                     AND (X_Attribute2 IS NULL)))
179            AND (   (Recinfo.attribute3 = X_Attribute3)
180                 OR (    (Recinfo.attribute3 IS NULL)
181                     AND (X_Attribute3 IS NULL)))
182            AND (   (Recinfo.attribute4 = X_Attribute4)
183                 OR (    (Recinfo.attribute4 IS NULL)
184                     AND (X_Attribute4 IS NULL)))
185            AND (   (Recinfo.attribute5 = X_Attribute5)
186                 OR (    (Recinfo.attribute5 IS NULL)
187                     AND (X_Attribute5 IS NULL)))
188            AND (   (Recinfo.attribute6 = X_Attribute6)
189                 OR (    (Recinfo.attribute6 IS NULL)
190                     AND (X_Attribute6 IS NULL)))
191            AND (   (Recinfo.attribute7 = X_Attribute7)
192                 OR (    (Recinfo.attribute7 IS NULL)
193                     AND (X_Attribute7 IS NULL)))
194            AND (   (Recinfo.attribute8 = X_Attribute8)
195                 OR (    (Recinfo.attribute8 IS NULL)
196                     AND (X_Attribute8 IS NULL)))
197            AND (   (Recinfo.attribute9 = X_Attribute9)
198                 OR (    (Recinfo.attribute9 IS NULL)
199                     AND (X_Attribute9 IS NULL)))
200            AND (   (Recinfo.attribute10 = X_Attribute10)
201                 OR (    (Recinfo.attribute10 IS NULL)
202                     AND (X_Attribute10 IS NULL)))
203            AND (   (Recinfo.attribute11 = X_Attribute11)
204                 OR (    (Recinfo.attribute11 IS NULL)
205                     AND (X_Attribute11 IS NULL)))
206            AND (   (Recinfo.attribute12 = X_Attribute12)
207                 OR (    (Recinfo.attribute12 IS NULL)
208                     AND (X_Attribute12 IS NULL)))
209            AND (   (Recinfo.attribute13 = X_Attribute13)
210                 OR (    (Recinfo.attribute13 IS NULL)
211                     AND (X_Attribute13 IS NULL)))
212            AND (   (Recinfo.attribute14 = X_Attribute14)
213                 OR (    (Recinfo.attribute14 IS NULL)
214                     AND (X_Attribute14 IS NULL)))
215            AND (   (Recinfo.attribute15 = X_Attribute15)
216                 OR (    (Recinfo.attribute15 IS NULL)
217                     AND (X_Attribute15 IS NULL)))
218 
219             ) then
220       return;
221     else
222       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
223       APP_EXCEPTION.RAISE_EXCEPTION;
224     end if;
225   END Lock_Row;
226 
227 
228 
229   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
230                        X_Department_Id                  NUMBER,
231                        X_Cost_Type_Id                   NUMBER,
232                        X_Overhead_Id                    NUMBER,
233                        X_Last_Update_Date               DATE,
234                        X_Last_Updated_By                NUMBER,
235                        X_Last_Update_Login              NUMBER DEFAULT NULL,
236                        X_Organization_Id                NUMBER,
237                        X_Basis_Type                     NUMBER,
238                        X_Rate_Or_Amount                 NUMBER,
239                        X_Activity_Id                    NUMBER DEFAULT NULL,
240                        X_Attribute_Category             VARCHAR2 DEFAULT NULL,
241                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
242                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
243                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
244                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
245                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
246                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
247                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
248                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
249                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
250                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
251                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
252                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
253                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
254                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
255                        X_Attribute15                    VARCHAR2 DEFAULT NULL
256 
257  ) IS
258  BEGIN
259    UPDATE CST_DEPARTMENT_OVERHEADS
260    SET
261      department_id                     =     X_Department_Id,
262      cost_type_id                      =     X_Cost_Type_Id,
263      overhead_id                       =     X_Overhead_Id,
264      last_update_date                  =     X_Last_Update_Date,
265      last_updated_by                   =     X_Last_Updated_By,
266      last_update_login                 =     X_Last_Update_Login,
267      organization_id                   =     X_Organization_Id,
268      basis_type                        =     X_Basis_Type,
269      rate_or_amount                    =     X_Rate_Or_Amount,
270      activity_id                       =     X_Activity_Id,
271      attribute_category                =     X_Attribute_Category,
275      attribute4                        =     X_Attribute4,
272      attribute1                        =     X_Attribute1,
273      attribute2                        =     X_Attribute2,
274      attribute3                        =     X_Attribute3,
276      attribute5                        =     X_Attribute5,
277      attribute6                        =     X_Attribute6,
278      attribute7                        =     X_Attribute7,
279      attribute8                        =     X_Attribute8,
280      attribute9                        =     X_Attribute9,
281      attribute10                       =     X_Attribute10,
282      attribute11                       =     X_Attribute11,
283      attribute12                       =     X_Attribute12,
284      attribute13                       =     X_Attribute13,
285      attribute14                       =     X_Attribute14,
286      attribute15                       =     X_Attribute15
287    WHERE rowid = X_rowid;
288 
289     if (SQL%NOTFOUND) then
290       Raise NO_DATA_FOUND;
291     end if;
292 
293   END Update_Row;
294 
295   PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
296   BEGIN
297     DELETE FROM CST_DEPARTMENT_OVERHEADS
298     WHERE  rowid = X_Rowid;
299 
300     if (SQL%NOTFOUND) then
301       Raise NO_DATA_FOUND;
302     end if;
303   END Delete_Row;
304 
305 END CST_DEPARTMENT_OVERHEADS_PKG;