DBA Data[Home] [Help]

PACKAGE BODY: APPS.FEM_COMPOSITE_DIM_UTILS_PVT

Source


1 PACKAGE BODY FEM_COMPOSITE_DIM_UTILS_PVT AS
2 /* $Header: FEMVCDUB.pls 120.3 2006/09/21 08:26:53 nmartine noship $ */
3 
4 
5 -------------------------------
6 -- Declare package constants --
7 -------------------------------
8 
9   -- Log Level Constants
10   G_LOG_LEVEL_1                constant number := FND_LOG.Level_Statement;
11   G_LOG_LEVEL_2                constant number := FND_LOG.Level_Procedure;
12   G_LOG_LEVEL_3                constant number := FND_LOG.Level_Event;
13   G_LOG_LEVEL_4                constant number := FND_LOG.Level_Exception;
14   G_LOG_LEVEL_5                constant number := FND_LOG.Level_Error;
15   G_LOG_LEVEL_6                constant number := FND_LOG.Level_Unexpected;
16 
17   -- Seeded Financial Element IDs
18   G_FIN_ELEM_ID_STATISTIC      constant number := 10000;
19   G_FIN_ELEM_ID_ACTIVITY_RATE  constant number := 5005;
20 
21 ------------------------------
22 -- Declare package messages --
23 ------------------------------
24   G_CDU_BAD_COMP_DIM_WC_ERR    constant varchar2(30) := 'FEM_CDU_BAD_COMP_DIM_WC_ERR';
25 
26 --------------------------------------
27 -- Declare package type definitions --
28 --------------------------------------
29   t_return_status                 varchar2(1);
30   t_msg_count                     number;
31   t_msg_data                      varchar2(2000);
32 
33 ------------------------------
34 -- Declare package variables --
35 -------------------------------
36 
37 
38 --------------------------------
39 -- Declare package exceptions --
40 --------------------------------
41 
42 
43 -----------------------------------------------
44 -- Declare private procedures and functions --
45 -----------------------------------------------
46 FUNCTION Get_Comp_Dim_Where_Clause (
47   p_comp_dim_req_column           in varchar2
48   ,p_source_table_alias           in varchar2
49   ,p_target_table_name            in varchar2
50   ,p_target_table_alias           in varchar2
51 )
52 RETURN long;
53 
54 
55 --------------------------------------------------------------------------------
56 --  Package bodies for functions/procedures
57 --------------------------------------------------------------------------------
58 
59 /*============================================================================+
60  | PROCEDURE
61  |   Populate_Cost_Object_Id
62  |
63  | DESCRIPTION
64  |   Populates the COST_OBJECT_ID column value on the specified target table.
65  |
66  | SCOPE - PUBLIC
67  |
68  | PARAMETERS
69  |
70  |   IN
71  |     p_api_version
72  |         Current version of this API.
73  |     p_init_msg_list
74  |         Flag indicating if FND_MSG_PUB should be initialized or not.
75  |     p_commit
76  |         Flag indicating if this API should commit after completion.
77  |     p_object_type_code
78  |         The Object Type Code of the calling program.
79  |     p_source_table_query
80  |         A SQL query string to be used for querying all the Cost Objects
81  |         that require population of COST_OBJECT_ID.  The FROM clause must
82  |         reference a source table that contains all the component dimension
83  |         ID columns of the Cost Object dimension.  An alias for that source
84  |         table must be specified and must match the value specified for the
85  |         p_source_table_alias parameter.
86  |     p_source_table_query_param1
87  |         The source table query where clause bind parameter 1 (optional)
88  |     p_source_table_query_param2
89  |         The source table query where clause bind parameter 2 (optional)
90  |     p_source_table_alias
91  |         The source table alias.  Alias must match the alias used in
92  |         p_source_table_query.
93  |     p_target_table_name
94  |         The target table name.
95  |     p_target_table_alias
96  |         The target table alias.
97  |     p_target_dsg_where_clause
98  |         The Dataset Group where-clause string to be used on the target table.
99  |         NOTE:  If an alias was specified in the Dataset Group where-clause,
100  |         it must match the value specified for the p_target_table_alias
101  |         parameter.
102  |
103  |   OUT
104  |     x_return_status
105  |         Possible return status.
106  |     x_msg_count
107  |         Count of messages returned.  If x_msg_count = 1, then the message
108  |         is returned in x_msg_data.  If x_msg_count > 1, then messages are
109  |         returned via FND_MSG_PUB.
110  |     x_msg_data
111  |          Error message returned.
112  |
113  |
114  | MODIFICATION HISTORY
115  |   nmartine   31-JAN-2005  Created
116  |
117  +============================================================================*/
118 
119 PROCEDURE Populate_Cost_Object_Id (
120   p_api_version                   in number
121   ,p_init_msg_list                in varchar2 := FND_API.G_FALSE
122   ,p_commit                       in varchar2 := FND_API.G_FALSE
123   ,x_return_status                out nocopy  varchar2
124   ,x_msg_count                    out nocopy  number
125   ,x_msg_data                     out nocopy  varchar2
126   ,p_object_type_code             in varchar2
127   ,p_source_table_query           in long
128   ,p_source_table_query_param1    in number   default null
129   ,p_source_table_query_param2    in number   default null
130   ,p_source_table_alias           in varchar2
131   ,p_target_table_name            in varchar2
132   ,p_target_table_alias           in varchar2
133   ,p_target_dsg_where_clause      in long
134 )
135 IS
136 
137   -----------------------
138   -- Declare constants --
139   -----------------------
140   l_api_name             constant varchar2(30) := 'Populate_Cost_Object_Id';
141   l_api_version          constant number       := 1.0;
142 
143   -----------------------
144   -- Declare variables --
145   -----------------------
146   l_comp_dim_update_stmt          long;
147   l_comp_dim_where_clause         long;
148 
149   l_return_status                 t_return_status%TYPE;
150   l_msg_count                     t_msg_count%TYPE;
151   l_msg_data                      t_msg_data%TYPE;
152 
153 BEGIN
154 
155   -- Standard Start of API Savepoint
156   savepoint Populate_Cost_Object_Id_PVT;
157 
158   -- Standard call to check for call compatibility
159   if not FND_API.Compatible_API_Call (
160     p_current_version_number => l_api_version
161     ,p_caller_version_number => p_api_version
162     ,p_api_name              => l_api_name
163     ,p_pkg_name              => G_PKG_NAME
164   ) then
165     raise FND_API.G_EXC_UNEXPECTED_ERROR;
166   end if;
167 
168   -- Initialize Message Stack on FND_MSG_PUB
169   if (FND_API.To_Boolean(p_init_msg_list)) then
170     FND_MSG_PUB.Initialize;
171   end if;
172 
173   FEM_ENGINES_PKG.Tech_Message (
174     p_severity  => G_LOG_LEVEL_2
175     ,p_module   => G_BLOCK||'.'||l_api_name
176     ,p_msg_text => 'BEGIN'
177   );
178 
179   ------------------------------------------------
180   -- Initialize Package and Procedure Variables --
181   ------------------------------------------------
182   -- Initialize API return status to success
183   x_return_status := FND_API.G_RET_STS_SUCCESS;
184 
185   ------------------------------------------------------------------------------
186   -- STEP 1: Get Cost Object Dimension Where Clause
187   ------------------------------------------------------------------------------
188   FEM_ENGINES_PKG.tech_message (
189     p_severity  => G_LOG_LEVEL_1
190     ,p_module   => G_BLOCK||'.'||l_api_name
191     ,p_msg_text => 'Step 1: Get Cost Object Dimension Where Clause'
192   );
193 
194   l_comp_dim_where_clause :=
195     Get_Comp_Dim_Where_Clause (
196       p_comp_dim_req_column => 'cost_obj'
197       ,p_source_table_alias => p_source_table_alias
198       ,p_target_table_name  => p_target_table_name
199       ,p_target_table_alias => p_target_table_alias
200     );
201 
202   if (l_comp_dim_where_clause is null) then
203     FEM_ENGINES_PKG.User_Message (
204       p_app_name  => G_FEM
205       ,p_msg_name => G_CDU_BAD_COMP_DIM_WC_ERR
206       ,p_token1   => 'COLUMN_NAME'
207       ,p_value1   => 'COST_OBJECT_ID'
208       ,p_token2   => 'TABLE_NAME'
209       ,p_value2   => p_target_table_name
210     );
211     raise FND_API.G_EXC_ERROR;
212   end if;
213 
214   ------------------------------------------------------------------------------
215   -- STEP 2: Build Cost Object Dynamic Update Statement
216   ------------------------------------------------------------------------------
217   FEM_ENGINES_PKG.tech_message (
218     p_severity  => G_LOG_LEVEL_1
219     ,p_module   => G_BLOCK||'.'||l_api_name
220     ,p_msg_text => 'Step 2: Build Cost Object Update Statement'
221   );
222 
223   l_comp_dim_update_stmt :=
224   ' update '||p_target_table_name||' '||p_target_table_alias||
225   ' set cost_object_id = ('||
226       p_source_table_query||
227       l_comp_dim_where_clause||
228   ' )'||
229   ' where currency_type_code = ''ENTERED'''||
230   ' and cost_object_id is null'||
231   ' and '||p_target_dsg_where_clause||
232   ' and exists ('||
233       p_source_table_query||
234       l_comp_dim_where_clause||
235   ' )';
236 
237   ------------------------------------------------------------------------------
238   -- STEP 3: Execute Dynamic Update Statement
239   ------------------------------------------------------------------------------
240   FEM_ENGINES_PKG.tech_message (
241     p_severity  => G_LOG_LEVEL_1
242     ,p_module   => G_BLOCK||'.'||l_api_name
243     ,p_msg_text => 'Step 3: Execute Dynamic Update Statement'
244   );
245 
246   -- Execute dynamic Update SQL statement
247   if (p_source_table_query_param1 is not null) then
248 
249     if (p_source_table_query_param2 is not null) then
250       execute immediate l_comp_dim_update_stmt
251       using p_source_table_query_param1
252       ,p_source_table_query_param2
253       ,p_source_table_query_param1
254       ,p_source_table_query_param2;
255     else
256       execute immediate l_comp_dim_update_stmt
257       using p_source_table_query_param1
258       ,p_source_table_query_param1;
259     end if;
260 
261   else
262 
263     if (p_source_table_query_param2 is not null) then
264       execute immediate l_comp_dim_update_stmt
265       using p_source_table_query_param2
266       ,p_source_table_query_param2;
267     else
268       execute immediate l_comp_dim_update_stmt;
269     end if;
270 
271   end if;
272 
273   -- Standard check of p_commit
274   if FND_API.To_Boolean(p_commit) then
275     commit work;
276   end if;
277 
278   -- Standard call to get message count and if count is 1, get message info
279   FND_MSG_PUB.Count_And_Get (
280     p_count => x_msg_count
281     ,p_data => x_msg_data
282   );
283 
284   FEM_ENGINES_PKG.Tech_Message (
285     p_severity  => G_LOG_LEVEL_2
286     ,p_module   => G_BLOCK||'.'||l_api_name
287     ,p_msg_text => 'END'
288   );
289 
290 EXCEPTION
291 
292   when FND_API.G_EXC_ERROR then
293 
294     rollback to Populate_Cost_Object_Id_PVT;
295     x_return_status := FND_API.G_RET_STS_ERROR;
296     FND_MSG_PUB.Count_And_Get (
297       p_count => x_msg_count
298       ,p_data => x_msg_data
299     );
300 
301   when FND_API.G_EXC_UNEXPECTED_ERROR then
302 
303     rollback to Populate_Cost_Object_Id_PVT;
304     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
305     FND_MSG_PUB.Count_And_Get (
306       p_count => x_msg_count
307       ,p_data => x_msg_data
308     );
309 
310   when others then
311 
312     rollback to Populate_Cost_Object_Id_PVT;
313     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
314     if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) then
315       FND_MSG_PUB.Add_Exc_Msg (
316         p_pkg_name        => G_PKG_NAME
317         ,p_procedure_name => l_api_name
318       );
319     end if;
320     FND_MSG_PUB.Count_And_Get (
321       p_count => x_msg_count
322       ,p_data => x_msg_data
323     );
324 
325 END Populate_Cost_Object_Id;
326 
327 
328 
329 /*============================================================================+
330  | PROCEDURE
331  |   Populate_Activity_Id
332  |
333  | DESCRIPTION
334  |   Populates the ACTIVITY_ID column value on the specified target table.
335  |
336  | SCOPE - PUBLIC
337  |
338  | PARAMETERS
339  |
340  |   IN
341  |     p_api_version
342  |         Current version of this API.
343  |     p_init_msg_list
344  |         Flag indicating if FND_MSG_PUB should be initialized or not.
345  |     p_commit
346  |         Flag indicating if this API should commit after completion.
347  |     p_object_type_code
348  |         The Object Type Code of the calling program.
349  |     p_source_table_query
350  |         A SQL query string to be used for querying all the Activities
351  |         that require population of ACTIVITY_ID.  The FROM clause must
352  |         reference a source table that contains all the component dimension
353  |         ID columns of the Activity dimension.  An alias for that source
354  |         table must be specified and must match the value specified for the
355  |         p_source_table_alias parameter.
356  |     p_source_table_query_param1
357  |         The source table query where clause bind parameter 1 (optional)
358  |     p_source_table_query_param2
359  |         The source table query where clause bind parameter 2 (optional)
360  |     p_source_table_alias
361  |         The source table alias.  Alias must match the alias used in
362  |         p_source_table_query.
366  |         The target table alias.
363  |     p_target_table_name
364  |         The target table name.
365  |     p_target_table_alias
367  |     p_target_dsg_where_clause
368  |         The Dataset Group where-clause string to be used on the target table.
369  |         NOTE:  If an alias was specified in the Dataset Group where-clause,
370  |         it must match the value specified for the p_target_table_alias
371  |         parameter.
372  |     p_ledger_id
373  |         Ledger Id.
374  |     p_statistic_basis_id
375  |         Statistic Basis Id.  Optional, as it is only applicable for
376  |         Activity Statistic Rollup.
377  |
378  |   OUT
379  |     x_return_status
380  |         Possible return status.
381  |     x_msg_count
382  |         Count of messages returned.  If x_msg_count = 1, then the message
383  |         is returned in x_msg_data.  If x_msg_count > 1, then messages are
384  |         returned via FND_MSG_PUB.
385  |     x_msg_data
386  |          Error message returned.
387  |
388  |
389  | MODIFICATION HISTORY
390  |   nmartine   31-JAN-2005  Created
391  |
392  +============================================================================*/
393 
394 PROCEDURE Populate_Activity_Id (
395   p_api_version                   in number
396   ,p_init_msg_list                in varchar2 := FND_API.G_FALSE
397   ,p_commit                       in varchar2 := FND_API.G_FALSE
398   ,x_return_status                out nocopy  varchar2
399   ,x_msg_count                    out nocopy  number
400   ,x_msg_data                     out nocopy  varchar2
401   ,p_object_type_code             in varchar2
402   ,p_source_table_query           in long
403   ,p_source_table_query_param1    in number   default null
404   ,p_source_table_query_param2    in number   default null
405   ,p_source_table_alias           in varchar2
406   ,p_target_table_name            in varchar2
407   ,p_target_table_alias           in varchar2
408   ,p_target_dsg_where_clause      in long
409   ,p_ledger_id                    in number
410   ,p_statistic_basis_id           in number   default null
411 )
412 IS
413 
414   -----------------------
415   -- Declare constants --
416   -----------------------
417   l_api_name             constant varchar2(30) := 'Populate_Activity_Id';
418   l_api_version          constant number       := 1.0;
419 
420   -----------------------
421   -- Declare variables --
422   -----------------------
423   l_financial_elem_id_clause      varchar2(255);
424   l_line_item_id_clause           varchar2(255);
425 
426   l_comp_dim_update_stmt          long;
427   l_comp_dim_where_clause         long;
428 
429   l_return_status                 t_return_status%TYPE;
430   l_msg_count                     t_msg_count%TYPE;
431   l_msg_data                      t_msg_data%TYPE;
432 
433   ----------------------------
434   -- Declare static cursors --
435   ----------------------------
436 
437 
438 BEGIN
439 
440   -- Standard Start of API Savepoint
441   savepoint Populate_Activity_Id_PVT;
442 
443   -- Standard call to check for call compatibility
444   if not FND_API.Compatible_API_Call (
445     p_current_version_number => l_api_version
446     ,p_caller_version_number => p_api_version
447     ,p_api_name              => l_api_name
448     ,p_pkg_name              => G_PKG_NAME
449   ) then
450     raise FND_API.G_EXC_UNEXPECTED_ERROR;
451   end if;
452 
453   -- Initialize Message Stack on FND_MSG_PUB
454   if (FND_API.To_Boolean(p_init_msg_list)) then
455     FND_MSG_PUB.Initialize;
456   end if;
457 
458   FEM_ENGINES_PKG.Tech_Message (
459     p_severity  => G_LOG_LEVEL_2
460     ,p_module   => G_BLOCK||'.'||l_api_name
461     ,p_msg_text => 'BEGIN'
462   );
463 
464   ------------------------------------------------
465   -- Initialize Package and Procedure Variables --
466   ------------------------------------------------
467   -- Initialize API return status to success
468   x_return_status := FND_API.G_RET_STS_SUCCESS;
469 
470   ------------------------------------------------------------------------------
471   -- STEP 1: Get Activity Dimension Where Clause
472   ------------------------------------------------------------------------------
473   FEM_ENGINES_PKG.tech_message (
474     p_severity  => G_LOG_LEVEL_1
475     ,p_module   => G_BLOCK||'.'||l_api_name
476     ,p_msg_text => 'Step 1: Get Activity Dimension Where Clause'
477   );
478 
479   l_comp_dim_where_clause :=
480     Get_Comp_Dim_Where_Clause (
481       p_comp_dim_req_column => 'activity'
482       ,p_source_table_alias => p_source_table_alias
483       ,p_target_table_name  => p_target_table_name
484       ,p_target_table_alias => p_target_table_alias
485     );
486 
487   if (l_comp_dim_where_clause is null) then
488     FEM_ENGINES_PKG.User_Message (
489       p_app_name  => G_FEM
490       ,p_msg_name => G_CDU_BAD_COMP_DIM_WC_ERR
491       ,p_token1   => 'COLUMN_NAME'
492       ,p_value1   => 'ACTIVITY_ID'
493       ,p_token2   => 'TABLE_NAME'
494       ,p_value2   => p_target_table_name
495     );
496   end if;
497 
498   ------------------------------------------------------------------------------
499   -- STEP 2: Build Activity Dynamic Update Statement
500   ------------------------------------------------------------------------------
501   FEM_ENGINES_PKG.tech_message (
502     p_severity  => G_LOG_LEVEL_1
503     ,p_module   => G_BLOCK||'.'||l_api_name
504     ,p_msg_text => 'Step 2: Build Activity Update Statement'
505   );
506 
507   if (p_object_type_code = 'ACT_COST_ROLLUP') then
508     l_financial_elem_id_clause := 'financial_elem_id not in ('||
512       G_FIN_ELEM_ID_STATISTIC;
509       G_FIN_ELEM_ID_STATISTIC||','||G_FIN_ELEM_ID_ACTIVITY_RATE||')';
510   elsif (p_object_type_code = 'ACT_STAT_ROLLUP') then
511     l_financial_elem_id_clause := 'financial_elem_id = '||
513     if (p_statistic_basis_id is not null) then
514       l_line_item_id_clause := 'line_item_id = '||p_statistic_basis_id;
515     end if;
516   elsif (p_object_type_code = 'ACTIVITY_RATE') then
517     l_financial_elem_id_clause := 'financial_elem_id not in ('||
518       G_FIN_ELEM_ID_STATISTIC||','||G_FIN_ELEM_ID_ACTIVITY_RATE||')';
519   end if;
520 
521   if (l_line_item_id_clause is null) then
522     l_line_item_id_clause := '1=1';
523   end if;
524 
525   l_comp_dim_update_stmt :=
526   ' update '||p_target_table_name||' '||p_target_table_alias||
527   ' set activity_id = ('||
528       p_source_table_query||
529       l_comp_dim_where_clause||
530   ' )'||
531   ' where ledger_id = :b_ledger_id'||
532   ' and currency_type_code = ''ENTERED'''||
533   ' and activity_id is null'||
534   ' and '||l_financial_elem_id_clause||
535   ' and '||l_line_item_id_clause||
536   ' and '||p_target_dsg_where_clause||
537   ' and exists ('||
538       p_source_table_query||
539       l_comp_dim_where_clause||
540   ' )';
541 
542   ------------------------------------------------------------------------------
543   -- STEP 3: Execute Dynamic Update Statement
544   ------------------------------------------------------------------------------
545   FEM_ENGINES_PKG.tech_message (
546     p_severity  => G_LOG_LEVEL_1
547     ,p_module   => G_BLOCK||'.'||l_api_name
548     ,p_msg_text => 'Step 3: Execute Dynamic Update Statement'
549   );
550 
551   -- Execute dynamic Update SQL statement
552   if (p_source_table_query_param1 is not null) then
553 
554     if (p_source_table_query_param2 is not null) then
555       execute immediate l_comp_dim_update_stmt
556       using p_source_table_query_param1
557       ,p_source_table_query_param2
558       ,p_ledger_id
559       ,p_source_table_query_param1
560       ,p_source_table_query_param2;
561     else
562       execute immediate l_comp_dim_update_stmt
563       using p_source_table_query_param1
564       ,p_ledger_id
565       ,p_source_table_query_param1;
566     end if;
567 
568   else
569 
570     if (p_source_table_query_param2 is not null) then
571       execute immediate l_comp_dim_update_stmt
572       using p_source_table_query_param2
573       ,p_ledger_id
574       ,p_source_table_query_param2;
575     else
576       execute immediate l_comp_dim_update_stmt
577       using p_ledger_id;
578     end if;
579 
580   end if;
581 
582   -- Standard check of p_commit
583   if FND_API.To_Boolean(p_commit) then
584     commit work;
585   end if;
586 
587   -- Standard call to get message count and if count is 1, get message info
588   FND_MSG_PUB.Count_And_Get (
589     p_count => x_msg_count
590     ,p_data => x_msg_data
591   );
592 
593   FEM_ENGINES_PKG.Tech_Message (
594     p_severity  => G_LOG_LEVEL_2
595     ,p_module   => G_BLOCK||'.'||l_api_name
596     ,p_msg_text => 'END'
597   );
598 
599 EXCEPTION
600 
601   when FND_API.G_EXC_ERROR then
602 
603     rollback to Populate_Activity_Id_PVT;
604     x_return_status := FND_API.G_RET_STS_ERROR;
605     FND_MSG_PUB.Count_And_Get (
606       p_count => x_msg_count
607       ,p_data => x_msg_data
608     );
609 
610   when FND_API.G_EXC_UNEXPECTED_ERROR then
611 
612     rollback to Populate_Activity_Id_PVT;
613     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
614     FND_MSG_PUB.Count_And_Get (
615       p_count => x_msg_count
616       ,p_data => x_msg_data
617     );
618 
619   when others then
620 
621     rollback to Populate_Activity_Id_PVT;
622     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
623     if FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) then
624       FND_MSG_PUB.Add_Exc_Msg (
625         p_pkg_name        => G_PKG_NAME
626         ,p_procedure_name => l_api_name
627       );
628     end if;
629     FND_MSG_PUB.Count_And_Get (
630       p_count => x_msg_count
631       ,p_data => x_msg_data
632     );
633 
634 END Populate_Activity_Id;
635 
636 
637 
638 /*============================================================================+
639  | FUNCTION
640  |   Get_Comp_Dim_Where_Clause
641  |
642  | DESCRIPTION
643  |   todo
644  |
645  | SCOPE - PRIVATE
646  |
647  +============================================================================*/
648 
649 FUNCTION Get_Comp_Dim_Where_Clause (
650   p_comp_dim_req_column           in varchar2
651   ,p_source_table_alias           in varchar2
652   ,p_target_table_name            in varchar2
653   ,p_target_table_alias           in varchar2
654 )
655 RETURN long
656 IS
657 
658   l_comp_dim_sub_clause           long;
659   l_comp_dim_where_clause         long;
660 
661   l_comp_dim_stmt                 long;
662   l_comp_dim_cur                  dynamic_cursor;
663 
664 
665 BEGIN
666 
667   l_comp_dim_where_clause := null;
668 
669   l_comp_dim_stmt :=
670   ' select '' and '||p_source_table_alias||'.''||reqs.column_name||'' = '||
671     p_target_table_alias||'.''||reqs.column_name'||
672   ' from fem_column_requiremnt_b reqs'||
673   ' ,fem_tab_columns_v cols'||
674   ' where reqs.'||p_comp_dim_req_column||'_dim_requirement_code is not null'||
675   ' and reqs.'||p_comp_dim_req_column||'_dim_component_flag = ''Y'''||
676   ' and reqs.dimension_id is not null'||
677   ' and cols.table_name = :b_target_table_name'||
678   ' and cols.column_name = reqs.column_name';
679 
680   open l_comp_dim_cur
681   for l_comp_dim_stmt
682   using p_target_table_name;
683 
684   loop
685 
686     fetch l_comp_dim_cur into l_comp_dim_sub_clause;
687     exit when l_comp_dim_cur%NOTFOUND;
688 
689     l_comp_dim_where_clause := l_comp_dim_where_clause||l_comp_dim_sub_clause;
690 
691   end loop;
692 
693   close l_comp_dim_cur;
694 
695   return l_comp_dim_where_clause;
696 
697 END Get_Comp_Dim_Where_Clause;
698 
699 
700 
701 
702 END FEM_COMPOSITE_DIM_UTILS_PVT;