[Home] [Help]
PACKAGE BODY: APPS.GL_STAT_ACCOUNT_UOM_PKG
Source
1 PACKAGE BODY GL_STAT_ACCOUNT_UOM_PKG as
2 /* $Header: glisuomb.pls 120.5 2005/05/05 01:28:27 kvora ship $ */
3
4 --
5 -- PRIVATE FUNCTIONS
6 --
7
8 --
9 -- Procedure
10 -- select_row
11 -- Purpose
12 -- Used to select a particular source row
13 -- History
14 -- 01-20-94 D. J. Ogg Created
15 -- Arguments
16 -- recinfo Various information about the row
17 -- Example
18 -- gl_stat_account_uom_pkg.select_row(recinfo)
19 -- Notes
20 --
21 PROCEDURE select_row( recinfo IN OUT NOCOPY gl_stat_account_uom%ROWTYPE) IS
22 BEGIN
23 SELECT *
24 INTO recinfo
25 FROM gl_stat_account_uom
26 WHERE chart_of_accounts_id = recinfo.chart_of_accounts_id
27 AND account_segment_value = recinfo.account_segment_value;
28 END SELECT_ROW;
29
30
31 --
32 -- PUBLIC FUNCTIONS
33 --
34
35 PROCEDURE select_columns(
36 x_chart_of_accounts_id IN OUT NOCOPY NUMBER,
37 x_account_segment_value IN OUT NOCOPY VARCHAR2,
38 x_unit_of_measure IN OUT NOCOPY VARCHAR2,
39 x_description IN OUT NOCOPY VARCHAR2) IS
40
41 recinfo gl_stat_account_uom%ROWTYPE;
42
43 BEGIN
44 recinfo.chart_of_accounts_id := x_chart_of_accounts_id;
45 recinfo.account_segment_value := x_account_segment_value;
46
47 select_row(recinfo);
48
49 x_unit_of_measure := recinfo.unit_of_measure;
50 x_description := recinfo.description;
51
52 END select_columns;
53
54
55 PROCEDURE Insert_Row(X_Rowid IN OUT NOCOPY VARCHAR2,
56 X_Account_Segment_Value VARCHAR2,
57 X_Unit_Of_Measure VARCHAR2,
58 X_Chart_Of_Accounts_Id NUMBER,
59 X_Description VARCHAR2 DEFAULT NULL,
60 X_Last_Update_Date DATE DEFAULT NULL,
61 X_Last_Updated_By NUMBER DEFAULT NULL,
62 X_Creation_Date DATE DEFAULT NULL,
63 X_Created_By NUMBER DEFAULT NULL,
64 X_Last_Update_Login NUMBER DEFAULT NULL
65 ) IS
66 CURSOR C IS SELECT rowid FROM gl_stat_account_uom
67
68 WHERE account_segment_value = X_Account_Segment_Value
69
70 AND chart_of_accounts_id = X_Chart_Of_Accounts_Id;
71
72
73
74
75 BEGIN
76
77
78
79
80
81
82 INSERT INTO gl_stat_account_uom(
83 account_segment_value,
84 unit_of_measure,
85 chart_of_accounts_id,
86 description,
87 last_update_date,
88 last_updated_by,
89 creation_date,
90 created_by,
91 last_update_login
92 ) VALUES (
93 X_Account_Segment_Value,
94 X_Unit_Of_Measure,
95 X_Chart_Of_Accounts_Id,
96 X_Description,
97 X_Last_Update_Date,
98 X_Last_Updated_By,
99 X_Creation_Date,
100 X_Created_By,
101 X_Last_Update_Login
102
103 );
104
105 OPEN C;
106 FETCH C INTO X_Rowid;
107 if (C%NOTFOUND) then
108 CLOSE C;
109 RAISE NO_DATA_FOUND;
110 end if;
111 CLOSE C;
112 END Insert_Row;
113 PROCEDURE Lock_Row(X_Rowid VARCHAR2,
114
115 X_Account_Segment_Value VARCHAR2,
116 X_Unit_Of_Measure VARCHAR2,
117 X_Chart_Of_Accounts_Id NUMBER,
118 X_Description VARCHAR2 DEFAULT NULL
119 ) IS
120 CURSOR C IS
121 SELECT *
122 FROM gl_stat_account_uom
123 WHERE rowid = X_Rowid
124 FOR UPDATE of Account_Segment_Value NOWAIT;
125 Recinfo C%ROWTYPE;
126 BEGIN
127 OPEN C;
128 FETCH C INTO Recinfo;
129 if (C%NOTFOUND) then
130 CLOSE C;
131 RAISE NO_DATA_FOUND;
132 end if;
133 CLOSE C;
134 if (
135 ( (Recinfo.account_segment_value = X_Account_Segment_Value)
136 OR ( (Recinfo.account_segment_value IS NULL)
137 AND (X_Account_Segment_Value IS NULL)))
138 AND ( (Recinfo.unit_of_measure = X_Unit_Of_Measure)
139 OR ( (Recinfo.unit_of_measure IS NULL)
140 AND (X_Unit_Of_Measure IS NULL)))
141 AND ( (Recinfo.chart_of_accounts_id = X_Chart_Of_Accounts_Id)
142 OR ( (Recinfo.chart_of_accounts_id IS NULL)
143 AND (X_Chart_Of_Accounts_Id IS NULL)))
144 AND ( (Recinfo.description = X_Description)
145 OR ( (Recinfo.description IS NULL)
146 AND (X_Description IS NULL)))
147 ) then
148 return;
149 else
150 FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
151 APP_EXCEPTION.RAISE_EXCEPTION;
152 end if;
153 END Lock_Row;
154
155 PROCEDURE Update_Row(X_Rowid VARCHAR2,
156 X_Account_Segment_Value VARCHAR2,
157 X_Unit_Of_Measure VARCHAR2,
158 X_Chart_Of_Accounts_Id NUMBER,
159 X_Description VARCHAR2 DEFAULT NULL,
160 X_Last_Update_Date DATE DEFAULT NULL,
161 X_Last_Updated_By NUMBER DEFAULT NULL,
162 X_Last_Update_Login NUMBER DEFAULT NULL
163 ) IS
164 BEGIN
165 UPDATE gl_stat_account_uom
166 SET
167
168 account_segment_value = X_Account_Segment_Value,
169 unit_of_measure = X_Unit_Of_Measure,
170 chart_of_accounts_id = X_Chart_Of_Accounts_Id,
171 description = X_Description,
172 last_update_date = X_Last_Update_Date,
173 last_updated_by = X_Last_Updated_By,
174 last_update_login = X_Last_Update_Login
175 WHERE rowid = X_rowid;
176
177 if (SQL%NOTFOUND) then
178 RAISE NO_DATA_FOUND;
179 end if;
180
181 END Update_Row;
182
183 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
184 BEGIN
185 DELETE FROM gl_stat_account_uom
186 WHERE rowid = X_Rowid;
187
188 if (SQL%NOTFOUND) then
189 RAISE NO_DATA_FOUND;
190 end if;
191 END Delete_Row;
192
193 PROCEDURE Check_Unique(X_Rowid VARCHAR2,
194 X_Account_Segment_Value VARCHAR2,
195 X_Chart_Of_Accounts_Id NUMBER) IS
196 dummy number;
197 BEGIN
198 select 1 into dummy from dual where not exists
199 (select 1 from gl_stat_account_uom
200 where account_segment_value = X_Account_Segment_Value
201 and chart_of_accounts_id = X_Chart_Of_Accounts_Id
202 and ((X_Rowid is null) or (rowid <> X_Rowid))
203 );
204 EXCEPTION
205 when no_data_found then
206 fnd_message.set_name('SQLGL','GL_ONE_UNIT_PER_ACCOUNT');
207 app_exception.raise_exception;
208 END Check_Unique;
209
210 END GL_STAT_ACCOUNT_UOM_PKG;