DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_ASSIGN_ASSETS_PKG

Source


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