DBA Data[Home] [Help]

PACKAGE BODY: APPS.ENG_CHANGE_TEXT_PVT

Source


1 PACKAGE BODY ENG_CHANGE_TEXT_PVT AS
2 /* $Header: ENGVIDXB.pls 120.2 2006/02/21 00:52:53 lkasturi noship $ */
3 
4 G_PKG_NAME	CONSTANT  VARCHAR2(30)  :=  'ENG_CHANGE_TEXT_PVT';
5 
6 -- -----------------------------------------------------------------------------
7 --  				Private Globals
8 -- -----------------------------------------------------------------------------
9 
10 g_Ctx_Schema		CONSTANT  VARCHAR2(30)  :=  'CTXSYS';
11 --g_Apps_Schema		VARCHAR2(30);
12 g_Prod_Schema			VARCHAR2(30);
13 g_Index_Owner			VARCHAR2(30);
14 g_Pref_Owner			VARCHAR2(30);
15 
16 g_installed		BOOLEAN;
17 g_inst_status		VARCHAR2(1);
18 g_industry		VARCHAR2(1);
19 
20 --g_Debug		VARCHAR2(1)  :=  NVL(fnd_profile.value('AFLOG_ENABLED'), 'N');
21 --g_debug		NUMBER  :=  NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'), 0);
22 
23 -- Log mode
24 g_Log_Mode		VARCHAR2(30)  :=  NULL;
25 g_Conc_Req_flag		BOOLEAN  :=  TRUE;
26 g_Log_Sqlplus_Flag	BOOLEAN  :=  FALSE;
27 g_Log_File_Flag		BOOLEAN  :=  TRUE;
28 g_Log_Dbdrv_Flag	BOOLEAN  :=  FALSE;
29 
30 g_Msg_Text		VARCHAR2(1000);
31 
32 -- Log directory
33 g_Log_Dir		v$parameter.value%TYPE;
34 g_Dump_Dir		v$parameter.value%TYPE;
35 
36 -- Log files for Sqlplus
37 g_Log_File		VARCHAR2(30)  :=  'eng_change_text_tl_srs.log';
38 g_Out_File		VARCHAR2(30)  :=  'eng_cchange_text_tl_srs.out';
39 
40 -- -----------------------------------------------------------------------------
41 --				  Log_Line
42 -- -----------------------------------------------------------------------------
43 
44 PROCEDURE Log_Line ( p_Buffer  IN  VARCHAR2 )
45 IS
46 BEGIN
47    IF ( g_Log_File_Flag ) THEN
48       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/240 ) ) LOOP
49          FND_FILE.Put_Line (FND_FILE.Log, SUBSTRB(p_Buffer, l*240 + 1, 240));
50       END LOOP;
51    END IF;
52 
53    IF ( g_Log_Sqlplus_Flag ) THEN
54       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/255 ) ) LOOP
55          --DBMS_OUTPUT.Put_Line( SUBSTR(p_Buffer, l*255 + 1, 255) );
56          NULL;
57       END LOOP;
58    END IF;
59 
60    IF ( g_Log_Dbdrv_Flag ) THEN
61       --IF ( (INSTR(p_Buffer, 'Error:') + INSTR(p_Buffer, 'Warning:')) > 0 ) THEN
62       IF (    ( INSTR(p_Buffer, 'Error:') > 0 )
63            OR ( INSTR(p_Buffer, 'Warning:') > 0 )
64            OR ( INSTR(p_Buffer, 'Executing:') > 0 )
65            OR ( INSTR(p_Buffer, 'Done.') > 0 )
66            OR ( INSTR(p_Buffer, 'Upgrade:') > 0 ) )
67       THEN
68          g_Msg_Text := g_Msg_Text || SUBSTRB(p_Buffer, 1, 255) || FND_GLOBAL.Newline;
69       END IF;
70    END IF;
71 
72 EXCEPTION
73 
74 	WHEN others THEN
75 		NULL;
76 
77 END Log_Line;
78 
79 PROCEDURE Out_Line ( p_Buffer  IN  VARCHAR2 )
80 IS
81 BEGIN
82    IF ( g_Log_File_Flag ) THEN
83       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/240 ) ) LOOP
84          FND_FILE.Put_Line (FND_FILE.Log, SUBSTRB(p_Buffer, l*240 + 1, 240));
85       END LOOP;
86    END IF;
87 
88    IF ( g_Log_Sqlplus_Flag ) THEN
89       FOR l IN 0 .. ( FLOOR( (NVL(LENGTH(p_Buffer),0) - 1)/255 ) ) LOOP
90          --DBMS_OUTPUT.Put_Line( SUBSTR(p_Buffer, l*255 + 1, 255) );
91          NULL;
92       END LOOP;
93    END IF;
94 
95    IF ( g_Log_Dbdrv_Flag ) THEN
96       IF ( INSTR(p_Buffer, 'Completed ') > 0 ) THEN
97          g_Msg_Text := g_Msg_Text || SUBSTRB(p_Buffer, 1, 255) || FND_GLOBAL.Newline;
98       END IF;
99    END IF;
100 END Out_Line;
101 
102 -- -----------------------------------------------------------------------------
103 --				  set_Log_Mode
104 -- -----------------------------------------------------------------------------
105 
106 FUNCTION set_Log_Mode ( p_Mode  IN  VARCHAR2 )
107 RETURN VARCHAR2
108 IS
109    l_api_name		CONSTANT  VARCHAR2(30)  :=  'set_Log_Mode';
110 BEGIN
111    g_Log_Mode := p_Mode;
112 
113    g_Log_Sqlplus_Flag := ( INSTR(g_Log_Mode, 'SQLPLUS') > 0 );
114    g_Log_File_Flag    := ( (INSTR(g_Log_Mode, 'FILE') + INSTR(g_Log_Mode, 'SRS')) > 0 );
115    g_Log_Dbdrv_Flag   := ( INSTR(g_Log_Mode, 'DBDRV') > 0 );
116 
117    g_Msg_Text := NULL;
118 
119    -- Determine log directory
120 
121    BEGIN
122       SELECT value INTO g_Dump_Dir
123       FROM v$parameter WHERE name = 'user_dump_dest';
124 
125       SELECT TRANSLATE(LTRIM(value), ',', ' ') INTO g_Log_Dir
126       FROM v$parameter
127       WHERE name = 'utl_file_dir';
128 
129       IF ( g_Log_Dir IS NOT NULL ) THEN
130          IF ( INSTR(g_Log_Dir, ' ') > 0 ) THEN
131             g_Log_Dir := SUBSTRB(g_Log_Dir, 1, INSTR(g_Log_Dir,' ')-1);
132          END IF;
133       END IF;
134 
135    --EXCEPTION
136    --   WHEN others THEN
137    --      Log_Line ('Error determining CTX log directory: ' || SQLERRM);
138    END;
139 
140    IF ( NVL(FND_GLOBAL.CONC_REQUEST_ID,-1) < 0 ) THEN
141       g_Conc_Req_flag := FALSE;
142       FND_FILE.Put_Names (g_Log_File, g_Out_File, g_Log_Dir);
143       Log_Line (l_api_name || ': standalone execution');
144    ELSE
145       Log_Line (l_api_name || ': concurrent request');
146    END IF;
147 
148    Log_Line (l_api_name || ': log mode: ' || g_Log_Mode);
149    Log_Line (l_api_name || ': dump directory: ' || g_Dump_Dir);
150    Log_Line (l_api_name || ': CTX log directory: ' || g_Log_Dir);
151 
152    RETURN (NULL);
153 
154 END set_Log_Mode;
155 
156 PROCEDURE set_Log_Mode ( p_Mode  IN  VARCHAR2 )
157 IS
158    l_output_name	VARCHAR2(255);
159 BEGIN
160    l_output_name := set_Log_Mode (p_Mode);
161 END set_Log_Mode;
162 
163 -- -----------------------------------------------------------------------------
164 --			  Process_Index_Preferences
165 -- -----------------------------------------------------------------------------
166 
167 PROCEDURE Process_Index_Preferences
168 (
169    p_Index_Name		IN           VARCHAR2
170 ,  x_return_status	OUT  NOCOPY  VARCHAR2
171 )
172 IS
173    l_api_name		CONSTANT  VARCHAR2(30)  :=  'Process_Index_Preferences';
174    l_return_status		VARCHAR2(1);
175 
176    tspace_tbl_param		VARCHAR2(256);
177    tspace_idx_param		VARCHAR2(256);
178 
179    Lang_Code			VARCHAR2(4);
180    Lexer_Name			VARCHAR2(30);
181 
182    TYPE Lang_Code_List_type  IS TABLE OF VARCHAR2(4);
183    --TYPE Lang_ISO_List_type   IS TABLE OF VARCHAR2(2);
184 
185    Lang_Code_List    Lang_Code_List_type := Lang_Code_List_type
186                      ( 'US', 'GB', 'NL', 'D', 'DK', 'S', 'N',
187                        'F', 'I', 'E', 'ESA', 'EL',
188                        'JA', 'KO', 'ZHS', 'ZHT' );
189 
190    --Lang_ISO_List     Lang_ISO_List_type :=
191    --                  Lang_ISO_List_type ('EN', '', 'DE', 'SV', 'NO', 'FR', '', '');
192 
193    l_pre_name          ctxsys.ctx_preferences.pre_name%TYPE; -- Bug 4958959
194 BEGIN
195    Log_Line (l_api_name || ': begin');
196 
197    l_return_status := G_STATUS_SUCCESS;
198    ------------------------------
199    -- Drop existing preferences
200    ------------------------------
201 
202    Log_Line (l_api_name || ': dropping all existing preferences ...');
203 
204    l_pre_name := 'ENG_CHANGE_MULTI_LEXER'; -- Bug 4958959
205    FOR multi_lexer_rec IN	( SELECT pre_owner, pre_name
206                          	  FROM ctxsys.ctx_preferences
207                          	  WHERE pre_name = l_pre_name )
208    LOOP
209       ad_ctx_ddl.drop_preference (multi_lexer_rec.pre_owner ||'.'|| multi_lexer_rec.pre_name);
210    END LOOP;
211 
212    FOR sub_lexer_rec IN		( SELECT pre_owner, pre_name
213                        		  FROM ctxsys.ctx_preferences
214                        		  WHERE pre_name LIKE 'ENG_CHANGE_LEXER%' )
215    LOOP
216       ad_ctx_ddl.drop_preference (sub_lexer_rec.pre_owner ||'.'|| sub_lexer_rec.pre_name);
217    END LOOP;
218 
219    l_pre_name := 'ENG_CHANGE_WORDLIST'; -- Bug 4958959
220    FOR wordlist_rec IN		( SELECT pre_owner, pre_name
221                        		  FROM ctxsys.ctx_preferences
222                        		  WHERE pre_name = l_pre_name )
223    LOOP
224       ad_ctx_ddl.drop_preference (wordlist_rec.pre_owner ||'.'|| wordlist_rec.pre_name);
225    END LOOP;
226 
227    FOR stoplist_rec IN		( SELECT spl_owner, spl_name
228                        		  FROM ctxsys.ctx_stoplists
229                        		  WHERE spl_name = 'ENG_CHANGE_STOPLIST' )
230    LOOP
231       ad_ctx_ddl.Drop_Stoplist (stoplist_rec.spl_owner || '.ENG_CHANGE_STOPLIST');
232    END LOOP;
233 
234    FOR section_group_rec IN	( SELECT sgp_owner, sgp_name
235                        		  FROM ctxsys.ctx_section_groups
236                        		  WHERE sgp_name = 'ENG_CHANGE_SECTION_GROUP' )
237    LOOP
238       ad_ctx_ddl.Drop_Section_Group (section_group_rec.sgp_owner ||'.'|| section_group_rec.sgp_name);
239    END LOOP;
240 
241    l_pre_name := 'ENG_CHANGE_DATASTORE'; -- Bug 4958959
242    FOR datastore_rec IN		( SELECT pre_owner, pre_name
243                        		  FROM ctxsys.ctx_preferences
244                        		  WHERE pre_name = l_pre_name )
245    LOOP
246       ad_ctx_ddl.drop_preference (datastore_rec.pre_owner ||'.'|| datastore_rec.pre_name);
247    END LOOP;
248 
249    l_pre_name := 'ENG_CHANGE_STORAGE'; -- Bug 4958959
250    FOR storage_rec IN		( SELECT pre_owner, pre_name
251                        		  FROM ctxsys.ctx_preferences
252                        		  WHERE pre_name = l_pre_name )
253    LOOP
254       ad_ctx_ddl.drop_preference (storage_rec.pre_owner ||'.'|| storage_rec.pre_name);
255    END LOOP;
256 
257    ------------------------------
258    -- Create STORAGE preference
259    ------------------------------
260 
261    -- Index tables use the same tablespaces used by other  tables and indexes
262    -- or use logical tablespace for indexes (TRANSACTION_INDEXES).
263 
264    Log_Line (l_api_name || ': querying tablespace parameters ...');
265 
266    SELECT 'tablespace ' || tablespace_name ||
267           ' storage (initial 1M next 1M minextents 1 maxextents unlimited pctincrease 0)'
268      INTO tspace_tbl_param
269    FROM all_tables
270    WHERE owner = g_Prod_Schema AND table_name = 'ENG_CHANGE_IMTEXT_TL';
271 
272    SELECT 'tablespace ' || tablespace_name ||
273           ' storage (initial 1M next 1M minextents 1 maxextents unlimited pctincrease 0)'
274      INTO tspace_idx_param
275    FROM all_indexes
276    WHERE owner = g_Prod_Schema
277      AND index_name = 'ENG_CHANGE_IMTEXT_TL_U1'
278      AND table_name = 'ENG_CHANGE_IMTEXT_TL';
279 
280    Log_Line (l_api_name || ': creating STORAGE preference ...');
281 
282    ad_ctx_ddl.create_preference (g_Pref_Owner || '.ENG_CHANGE_STORAGE', 'BASIC_STORAGE');
283 
284    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.ENG_CHANGE_STORAGE',
285                              'I_TABLE_CLAUSE', tspace_tbl_param);
286 
287    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.ENG_CHANGE_STORAGE',
288                              'K_TABLE_CLAUSE', tspace_tbl_param);
289 
290    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.ENG_CHANGE_STORAGE',
291                              'R_TABLE_CLAUSE', tspace_tbl_param || ' LOB (data) STORE AS (CACHE)');
292 
293    -- Caching the "data" LOB column is the default (at later versions of Oracle Text).
294    -- For index specific STORAGE preference, setting the clause "lob (data) (cache reads)"
295    -- should be ensured (the "lob .. store as" clause is only for newly added LOB columns).
296    --alter table dr$prd_ctx_index$r modify lob (data) (cache reads);
297 
298    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.ENG_CHANGE_STORAGE',
299                              'N_TABLE_CLAUSE', tspace_tbl_param);
300 
301    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.ENG_CHANGE_STORAGE',
302                              'P_TABLE_CLAUSE', tspace_tbl_param);
303 
304    ad_ctx_ddl.set_attribute (g_Pref_Owner || '.ENG_CHANGE_STORAGE',
305                              'I_INDEX_CLAUSE', tspace_idx_param || ' COMPRESS 2');
306 
307    --ad_ctx_ddl.set_attribute (g_Pref_Owner || '.ENG_CHANGE_STORAGE',
308    --                          'I_ROWID_INDEX_CLAUSE', tspace_idx_param);
309 
310    --------------------------------
311    -- Create DATASTORE preference
312    --------------------------------
313 
314    Log_Line (l_api_name || ': creating DATASTORE preference ...');
315 
316    ad_ctx_ddl.Create_Preference (g_Pref_Owner || '.ENG_CHANGE_DATASTORE', 'USER_DATASTORE');
317 
318    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_DATASTORE', 'OUTPUT_TYPE', 'CLOB');
319    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_DATASTORE', 'PROCEDURE', '"ENG_CHANGE_TEXT_CTX_PKG"."Get_Change_Text_CLOB"');
320 
321    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_DATASTORE', 'OUTPUT_TYPE', 'VARCHAR2');
322    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_DATASTORE', 'PROCEDURE', '"ENG_CHANGE_TEXT_CTX_PKG"."Get_Change_Text_VARCHAR2"');
323 
324    ------------------------------------
325    -- Create SECTION GROUP preference
326    ------------------------------------
327 
328    --Log_Line (l_api_name || ': creating SECTION_GROUP preference ...');
329 
330    --ad_ctx_ddl.Create_Section_Group (g_Pref_Owner || '.ENG_CHANGE_STOPLIST', 'AUTO_SECTION_GROUP');
331 
332    -------------------------------
333    -- Create STOPLIST preference
334    -------------------------------
335 
336    Log_Line (l_api_name || ': creating STOPLIST preference ...');
337 
338    -- This should create stoplist equivalent to CTXSYS.EMPTY_STOPLIST
339    ad_ctx_ddl.Create_Stoplist (g_Pref_Owner || '.ENG_CHANGE_STOPLIST');
340 
341    -------------------------------
342    -- Create WORDLIST preference
343    -------------------------------
344 
345    Log_Line (l_api_name || ': creating WORDLIST preference ...');
346 
347    ad_ctx_ddl.Create_Preference (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'BASIC_WORDLIST');
348 
349    -- Enable prefix indexing to improve performance for wildcard searches
350    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'PREFIX_INDEX', 'TRUE');
351    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'PREFIX_MIN_LENGTH', 2);
352    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'PREFIX_LENGTH_MIN', 2);
353    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'PREFIX_MAX_LENGTH', 32);
354    --ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'PREFIX_LENGTH_MAX', 32);
355    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'WILDCARD_MAXTERMS', 5000);
356 
357    -- This option should be TRUE only when left-truncated wildcard searching is expected
358    -- to be frequent and needs to be fast (at the cost of increased index time and space).
359    --
360    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'SUBSTRING_INDEX', 'FALSE');
361 
362    -- WORDLIST attribute defaults: STEMMER: 'ENGLISH'; FUZZY_MATCH: 'GENERIC'
363    -- Use automatic language detection for stemming and fuzzy matching
364    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'STEMMER', 'AUTO');
365    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'FUZZY_MATCH', 'AUTO');
366    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'FUZZY_SCORE', 40);
367    ad_ctx_ddl.Set_Attribute (g_Pref_Owner || '.ENG_CHANGE_WORDLIST', 'FUZZY_NUMRESULTS', 120);
368 
369    -----------------------------------------------
370    -- Create language-specific LEXER preferences
371    -----------------------------------------------
372 
373    Log_Line (l_api_name || ': creating language-specific LEXER preferences ...');
374 
375    FOR i IN Lang_Code_List.FIRST .. Lang_Code_List.LAST
376    LOOP
377       Lexer_Name := g_Pref_Owner || '.ENG_CHANGE_LEXER_' || Lang_Code_List(i);
378 
379       IF ( Lang_Code_List(i) = 'JA' ) THEN
380 
381          -- Use JAPANESE_LEXER if db charset is UTF8, JA16SJIS, or JA16EUC.
382          IF ( ENG_CHANGE_TEXT_UTIL.get_DB_Version_Num >= 9.0 ) THEN
383             ad_ctx_ddl.Create_Preference (Lexer_Name, 'JAPANESE_LEXER');
384          ELSE
385             ad_ctx_ddl.Create_Preference (Lexer_Name, 'JAPANESE_VGRAM_LEXER');
386          END IF;
387 
388       ELSIF ( Lang_Code_List(i) = 'KO' ) THEN
389 
390          -- Use KOREAN_MORPH_LEXER if db charset is UTF8 or KO16KSC5601.
394             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ONE_CHAR_WORD', 'TRUE');
391          IF ( ENG_CHANGE_TEXT_UTIL.get_DB_Version_Num >= 9.0 ) THEN
392             ad_ctx_ddl.Create_Preference (Lexer_Name, 'KOREAN_MORPH_LEXER');
393             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'VERB_ADJECTIVE', 'TRUE');
395             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMBER', 'TRUE');
396             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'NGRAM');
397             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'MORPHEME', 'TRUE');
398             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'HANJA', 'FALSE');
399             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'LONG_WORD', 'TRUE');
400             --ad_ctx_ddl.Set_Attribute (Lexer_Name, 'JAPANESE', 'FALSE');
401             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ENGLISH', 'TRUE');
402             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'TO_UPPER', 'TRUE');
403          ELSE
404             ad_ctx_ddl.Create_Preference (Lexer_Name, 'KOREAN_LEXER');
405             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'VERB', 'TRUE');
406             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ADJECTIVE', 'TRUE');
407             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ADVERB', 'TRUE');
408             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ONECHAR', 'TRUE');
409             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMBER', 'TRUE');
410             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'TRUE');
411             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'MORPHEME', 'TRUE');
412             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'TOHANGEUL', 'TRUE');
413             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'TOUPPER', 'TRUE');
414          END IF;
415 
416       ELSIF ( Lang_Code_List(i) IN ('ZHS', 'ZHT') ) THEN
417 
418          IF ( ENG_CHANGE_TEXT_UTIL.get_DB_Version_Num >= 9.2 ) THEN
419             ad_ctx_ddl.Create_Preference (Lexer_Name, 'CHINESE_LEXER');
420          ELSE
421             ad_ctx_ddl.Create_Preference (Lexer_Name, 'CHINESE_VGRAM_LEXER');
422          END IF;
423 
424       ELSE
425          -- All other languages use basic lexer.
426 
427          ad_ctx_ddl.Create_Preference (Lexer_Name, 'BASIC_LEXER');
428 
429          -- The following language-independent attributes are
430          -- common to the BASIC_LEXER preference object.
431 
432          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_TEXT', 'YES');
433          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_THEMES', 'NO');
434 
435          -- For printjoin characters include all possible flex segment separators
436          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'PRINTJOINS', '-_*~^+.$#@:|&');
437          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'CONTINUATION', '-\');
438          ad_ctx_ddl.Set_Attribute (Lexer_Name, 'PUNCTUATIONS', '.?!');
439 
440          -- The default values for numjoin and numgroup are determined by
441          -- the NLS initialization parameters that are specified for the database.
442          --ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMGROUP', ',');
443          --ad_ctx_ddl.Set_Attribute (Lexer_Name, 'NUMJOIN', '.');
444 
445          -- Stem indexing stems tokens at indexing time to a single base form in addition
446          -- to the normal forms. This enables better query performance for stem ($) queries.
447 
448          -- Disable stem indexing to improve index creation performance.
449          -- This would not affect stem expansion (with $) at query time.
450          --
451          --IF ( ENG_CHANGE_TEXT_UTIL.get_DB_Version_Num >= 9.2 ) THEN
452          --   IF ( Lang_Code_List(i) IN ('US', 'GB') ) THEN
453          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'ENGLISH');
454          --   ELSIF ( Lang_Code_List(i) = 'NL' ) THEN
455          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'DUTCH');
456          --   ELSIF ( Lang_Code_List(i) = 'D' ) THEN
457          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'GERMAN');
458          --   ELSIF ( Lang_Code_List(i) = 'F' ) THEN
459          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'FRENCH');
460          --   ELSIF ( Lang_Code_List(i) = 'I' ) THEN
461          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'ITALIAN');
462          --   ELSIF ( Lang_Code_List(i) IN ('E', 'ESA') ) THEN
463          --      ad_ctx_ddl.Set_Attribute (Lexer_Name, 'INDEX_STEMS', 'SPANISH');
464          --   END IF;
465          --END IF;
466 
467          -- Language-specific attribute values for BASIC_LEXER preference object
468 
469          IF ( Lang_Code_List(i) = 'NL' ) THEN
470             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'DUTCH');
471 
472          ELSIF ( Lang_Code_List(i) = 'D' ) THEN
473             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'COMPOSITE', 'GERMAN');
474             -- Basic lexer in 8.1.7 allows the MIXED_CASE to be FALSE when COMPOSITE is set.
475             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'MIXED_CASE', 'NO');
476             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'GERMAN');
477 
478          ELSIF ( Lang_Code_List(i) = 'DK' ) THEN
479             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'DANISH');
480 
481          ELSIF ( Lang_Code_List(i) = 'S' ) THEN
482             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'SWEDISH');
483 
484          ELSIF ( Lang_Code_List(i) = 'N' ) THEN
485             -- Both Norwegian and Danish use the same special characters that are
486             -- rendered alternatively as "aa", "ae", and "oe".
487             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'DANISH');
488 
489          ELSIF ( Lang_Code_List(i) = 'F' ) THEN
490             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'BASE_LETTER', 'YES');
491 
492          ELSE
493             ad_ctx_ddl.Set_Attribute (Lexer_Name, 'ALTERNATE_SPELLING', 'NONE');
494 
495          END IF;
496       END IF;
497 
498    END LOOP;  -- Lang_Code_List
499 
500    ----------------------------------
504    Log_Line (l_api_name || ': creating MULTI_LEXER preference ...');
501    -- Create MULTI_LEXER preference
502    ----------------------------------
503 
505 
506    ad_ctx_ddl.Create_Preference (g_Pref_Owner || '.ENG_CHANGE_MULTI_LEXER', 'MULTI_LEXER');
507 
508    FOR i IN Lang_Code_List.FIRST .. Lang_Code_List.LAST
509    LOOP
510       Lexer_Name := g_Pref_Owner || '.ENG_CHANGE_LEXER_' || Lang_Code_List(i);
511 
512       -- The language column is case-independent, and can contain either the NLS name
513       -- or abbreviation of the language.  If the table uses some other value for the
514       -- language, that alternate value needs to be specified as the fourth argument
515       -- when adding the sub lexers:
516 
517       IF ( Lang_Code_List(i) = 'US' ) THEN
518          -- US English lexer to handle everything else.
519          ad_ctx_ddl.Add_Sub_Lexer ( g_Pref_Owner || '.ENG_CHANGE_MULTI_LEXER', 'DEFAULT'
520                                   , g_Pref_Owner || '.ENG_CHANGE_LEXER_US' );
521       ELSE
522          ad_ctx_ddl.Add_Sub_Lexer
523          (  lexer_name    =>  g_Pref_Owner || '.ENG_CHANGE_MULTI_LEXER'
524          ,  language      =>  Lang_Code_List(i)
525          ,  sub_lexer     =>  Lexer_Name
526          --,  alt_value     =>  Lang_ISO_List(i)
527          );
528       END IF;
529 
530    END LOOP;
531 
532    x_return_status := l_return_status;
533 
534    Log_Line (l_api_name || ': end');
535 
536 EXCEPTION
537 
538    WHEN G_EXC_ERROR THEN
539       x_return_status := G_STATUS_ERROR;
540 
541    WHEN others THEN
542 
543       Log_Line (l_api_name || ': Error: ' || SQLERRM);
544       x_return_status := G_STATUS_UNEXP_ERROR;
545 
546 END Process_Index_Preferences;
547 
548 -- -----------------------------------------------------------------------------
549 --			   Process_Change_Text_Index
550 -- -----------------------------------------------------------------------------
551 
552 PROCEDURE Process_Change_Text_Index
553 (
554    p_Index_Name		IN           VARCHAR2
555 ,  p_Action		IN           VARCHAR2
556 ,  x_return_status	OUT  NOCOPY  VARCHAR2 -- Bug#4055218: Datatype of x_return_status changed to VARCHAR2
557 	                                      -- as in 8i DB Varchar2 data can't be assigned to CLOB.
558 )
559 IS
560    l_api_name		CONSTANT  VARCHAR2(30)  :=  'Process_Change_Text_Index';
561    l_return_status		VARCHAR2(1);
562    ctx_Log_File_Name		VARCHAR2(512)   :=  NULL;
563 
564    l_index_exists		BOOLEAN         :=  FALSE;
565    l_index_valid		BOOLEAN         :=  TRUE;
566 
567    l_create_index		BOOLEAN         :=  TRUE;
568    l_drop_index			BOOLEAN         :=  FALSE;
569 
570    l_rows_processed		INTEGER;
571 
572    -- Limit the indexing memory in case the default parameter max value is higher.
573    --l_Index_Memory		ctx_parameters.par_value%TYPE  :=  '67108864'; -- '64M'
574    l_Index_Memory		ctx_parameters.par_value%TYPE  :=  '134217728'; -- '128M'
575    l_Index_Memory_Max		ctx_parameters.par_value%TYPE;
576 
577    l_idx_docid_count		NUMBER;
578    l_idx_status			VARCHAR2(256);
579 
580    l_index_populate		VARCHAR2(30)    :=  'POPULATE';
581 
582    -- Use parallel indexing when this issue is resolved
583    c_parallel_clause	CONSTANT  VARCHAR2(30)  :=  'PARALLEL 4';
584    --c_parallel_clause	CONSTANT  VARCHAR2(30)  :=  NULL;
585 
586    l_index_parallel		VARCHAR2(30)    :=  NULL;
587    sql_stmt			VARCHAR2(32767);
588 BEGIN
589 
590    Log_Line (l_api_name || ': begin: Index_Name=' || p_Index_Name || ' Action=' || p_Action);
591 
592    l_return_status := G_STATUS_SUCCESS;
593 
594    IF ( p_Action NOT IN ('CREATE', 'REBUILD', 'UPGRADE', 'DROP') ) THEN
595       Log_Line (l_api_name || ': Error: invalid value for parameter p_Action: ' || p_Action);
596       RAISE G_EXC_ERROR;
597    END IF;
598 
599    -- Check for existing indexes in the ENG product, APPS Universal, and interMedia schemas.
600    --
601    FOR index_rec IN ( SELECT owner, index_name, status, domidx_status, domidx_opstatus
602                       FROM all_indexes
603                       WHERE ( owner = g_Prod_Schema OR owner = USER OR owner = g_Ctx_Schema )
604                         AND table_name = 'ENG_CHANGE_IMTEXT_TL'
605                         AND index_name = p_Index_Name )
606    LOOP
607       -- Check index schema
608       --
609       IF ( index_rec.owner <> g_Index_Owner )
610       THEN
611          Log_Line (l_api_name || ': Error: index exists in wrong schema: ' || index_rec.owner);
612          BEGIN
613             Log_Line (l_api_name || ': dropping index: ' || index_rec.owner || '.' || p_Index_Name);
614             EXECUTE IMMEDIATE 'DROP INDEX ' || index_rec.owner || '.' || p_Index_Name || ' FORCE';
615          EXCEPTION
616             WHEN others THEN
617                Log_Line (l_api_name || ': Error: DROP INDEX ' || index_rec.owner || '.' || p_Index_Name || ' FORCE: ' || SQLERRM);
618                l_return_status := G_STATUS_ERROR;
619          END;
620 
621       ELSE
622          l_index_exists := TRUE;
623 
624          -- Check status of an existing index, if any.
625          --
626          IF ( (NVL(index_rec.status, 'FAILED') <> 'VALID') OR
627               (NVL(index_rec.domidx_status, 'FAILED') <> 'VALID') OR
628               (NVL(index_rec.domidx_opstatus, 'FAILED') <> 'VALID') )
629          THEN
630             l_index_valid := FALSE;
631             Log_Line (l_api_name || ': Warning: existing index status is invalid:'
632                       || ' status=' || index_rec.status
633                       || ' domidx_status=' || index_rec.domidx_status
634                       || ' domidx_opstatus=' || index_rec.domidx_opstatus);
635          ELSE
639       END IF;  -- index owner
636             Log_Line (l_api_name || ': valid index exists: ' || index_rec.owner || '.' || p_Index_Name);
637          END IF;
638 
640 
641    END LOOP;  -- check for any existing indexes
642 
643    IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
644       RAISE G_EXC_ERROR;
645    END IF;
646 
647    --   x_return_status := l_return_status;
648 
649    -- Set indexing flags depending on the action and the index status
650 
651    IF ( p_Action = 'CREATE' ) THEN
652       IF ( l_index_exists ) THEN
653          IF ( l_index_valid ) THEN
654             Log_Line (l_api_name || ': Error: cannot execute ' || p_Action || ' because the index exists.');
655             RAISE G_EXC_ERROR;
656          ELSE
657             l_drop_index := TRUE;
658          END IF;
659       END IF;
660 
661    ELSIF ( p_Action = 'REBUILD' ) THEN
662       l_drop_index := l_index_exists;
663 
664    ELSIF ( p_Action = 'UPGRADE' ) THEN
665       IF ( l_index_exists ) THEN
666          IF ( l_index_valid ) THEN
667             Log_Line (l_api_name || ': Upgrade: skipping index creation because valid index exists.');
668             l_create_index := FALSE;
669          ELSE
670             l_drop_index := TRUE;
671          END IF;
672       END IF;
673 
674    ELSIF ( p_Action = 'DROP' ) THEN
675       l_create_index := FALSE;
676       IF ( l_index_exists ) THEN
677          l_drop_index := TRUE;
678       ELSE
679          Log_Line (l_api_name || ': Warning: cannot execute ' || p_Action || ' because the index does not exist.');
680          l_return_status := G_STATUS_WARNING;
681       END IF;
682 
683    END IF;  -- Action
684 
685    IF ( l_drop_index ) THEN
686       BEGIN
687          Log_Line (l_api_name || ': dropping index: ' || g_Index_Owner || '.' || p_Index_Name);
688          EXECUTE IMMEDIATE 'DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE';
689          IF ( l_index_valid ) THEN
690             Log_Line (l_api_name || ': existing index has been successfully dropped.');
691             Out_Line ('Existing index has been successfully dropped: ' || g_Index_Owner || '.' || p_Index_Name);
692          ELSE
693             Log_Line (l_api_name || ': invalid index has been dropped.');
694             Out_Line ('Invalid index has been dropped: ' || g_Index_Owner || '.' || p_Index_Name);
695          END IF;
696       EXCEPTION
697          WHEN others THEN
698             Log_Line (l_api_name || ': Error: DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE: ' || SQLERRM);
699             l_return_status := G_STATUS_ERROR;
700       END;
701    END IF;  -- drop index
702 
703    IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
704       RAISE G_EXC_ERROR;
705    END IF;
706 
707    -- Build index
708 
709    IF ( l_create_index ) THEN
710 
711       -- Determine index memory parameter value
712       --ctxsys.CTX_ADM.Set_Parameter ('MAX_INDEX_MEMORY', l_Index_Memory);
713       BEGIN
714          SELECT par_value INTO l_Index_Memory_Max
715          FROM ctx_parameters
716          WHERE par_name = 'MAX_INDEX_MEMORY';
717       EXCEPTION
718          WHEN no_data_found THEN
719             Log_Line (l_api_name || ': Error: MAX_INDEX_MEMORY parameter record not found.');
720             RAISE G_EXC_ERROR;
721       END;
722 
723       IF ( TO_NUMBER(l_Index_Memory) > TO_NUMBER(l_Index_Memory_Max) ) THEN
724          l_Index_Memory := l_Index_Memory_Max;
725       END IF;
726 
727       Log_Line (l_api_name || ': CTX index_memory: ' || l_Index_Memory);
728 
729       -- Decide whether parallel indexing can be used, depending on DB version.
730 
731       IF ( ENG_CHANGE_TEXT_UTIL.get_DB_Version_Num >= 9.2 ) THEN
732          l_index_parallel := c_parallel_clause;
733          Log_Line (l_api_name || ': DB version: ' || ENG_CHANGE_TEXT_UTIL.get_DB_Version_Str || ', using parallel clause: ' || l_index_parallel);
734       END IF;
735 
736       -- Start logging indexing progress
737 
738       IF ( g_Log_Dir IS NOT NULL ) THEN
739          BEGIN
740             Log_Line (l_api_name || ': CTX Log_Directory: ' || g_Log_Dir);
741             ctxsys.CTX_ADM.Set_Parameter ( 'LOG_DIRECTORY', g_Log_Dir );
742             Log_Line (l_api_name || ': CTX Start_Log');
743             CTX_OUTPUT.Start_Log ( LOWER(p_Index_Name) || '.log' );
744             ctx_Log_File_Name := CTX_OUTPUT.LogFileName;
745             Log_Line (l_api_name || ': CTX LogFileName:   ' || ctx_Log_File_Name);
746          EXCEPTION
747             WHEN others THEN
748                Log_Line (l_api_name || ': Warning: CTX Start_Log: ' || SQLERRM);
749                l_return_status := G_STATUS_WARNING;
750          END;
751       END IF;
752 
753       -- Choose indexing method
754       --IF ( ) THEN
755       --   l_index_populate := 'NOPOPULATE';
756       --END IF;
757 
758       IF ( l_create_index ) THEN
759       BEGIN
760 
761          ENG_CHANGE_TEXT_UTIL.Set_Context ('CREATE_INDEX');
762 
763          sql_stmt :=
764             'CREATE INDEX ' || g_Index_Owner || '.' || p_Index_Name              ||
765             ' ON ' || g_Prod_Schema || '.ENG_CHANGE_IMTEXT_TL (text)               ' ||
766             ' INDEXTYPE IS CTXSYS.context                                      ' ||
767             ' PARAMETERS                                                       ' ||
768             ' (''DATASTORE      ' || g_Pref_Owner || '.ENG_CHANGE_DATASTORE      ' ||
769             '  WORDLIST         ' || g_Pref_Owner || '.ENG_CHANGE_WORDLIST       ' ||
770             '  STOPLIST         ' || g_Pref_Owner || '.ENG_CHANGE_STOPLIST       ' ||
771             '  LEXER            ' || g_Pref_Owner || '.ENG_CHANGE_MULTI_LEXER    ' ||
775             '  STORAGE          ' || g_Pref_Owner || '.ENG_CHANGE_STORAGE        ' ||
772             '  LANGUAGE COLUMN  language                                       ' ||
773             --'  SECTION GROUP    ' || g_Pref_Owner || '.ENG_CHANGE_STOPLIST  ' ||
774             '  SECTION GROUP    CTXSYS.NULL_SECTION_GROUP  '                     ||
776             '  MEMORY           ' || l_Index_Memory ||
777             --'  ' || l_index_populate ||
778             ' '')' ;
779 --	    || '  ' || l_index_parallel ;
780 
781          Log_Line (l_api_name || ': creating index ' || g_Index_Owner || '.' || p_Index_Name || ' ...');
782          Log_Line (l_api_name || ': sql_stmt = ' || sql_stmt || ' /* End SQL */');
783 
784          EXECUTE IMMEDIATE sql_stmt;
785 
786          Log_Line (l_api_name || ': done creating index.');
787 
788       EXCEPTION
789 
790          WHEN others THEN
791             Log_Line (l_api_name || ': Error creating index ' || g_Index_Owner || '.' || p_Index_Name || ': ' || SQLERRM);
792 
793             -- Drop the index in case of an error during index creation to prevent the table lock.
794             BEGIN
795                EXECUTE IMMEDIATE 'DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE';
796             EXCEPTION
797                WHEN others THEN
798                   Log_Line (l_api_name || ': Error: DROP INDEX ' || g_Index_Owner || '.' || p_Index_Name || ' FORCE: ' || SQLERRM);
799                   RAISE G_EXC_ERROR;
800             END;
801 
802             RAISE G_EXC_ERROR;
803 
804       END;  -- execute sql
805       END IF;  -- create index
806 /*
807       Log_Line (l_api_name || ': calling Incremental_Sync');
808 
809       ENG_CHANGE_TEXT_UTIL.Incremental_Sync
810       (
811          p_Index_Name      =>  p_Index_Name
812       ,  p_batch_size      =>  40000
813       ,  x_rows_processed  =>  l_rows_processed
814       ,  x_return_status   =>  l_return_status
815       );
816 */
817       -- End logging
818 
819       IF ( ctx_Log_File_Name IS NOT NULL ) THEN
820          BEGIN
821             CTX_OUTPUT.End_Log;
822             Log_Line (l_api_name || ': CTX End_Log');
823          EXCEPTION
824             WHEN others THEN
825                Log_Line (l_api_name || ': Warning: CTX End_Log: ' || SQLERRM);
826                l_return_status := G_STATUS_WARNING;
827          END;
828       END IF;
829 
830        Log_Line (l_api_name || 'Completed building Change Management Text Index.');
831 
832       -- Check the created index status
833 
834          Log_Line (l_api_name || 'Checking Status of Change Management Text Index.');
835 
836          SELECT idx_docid_count, idx_status
837            INTO l_idx_docid_count, l_idx_status
838          FROM ctxsys.ctx_indexes
839          WHERE idx_owner = g_Index_Owner AND idx_name = 'ENG_CHANGE_IMTEXT_TL_CTX1'
840            AND idx_table = 'ENG_CHANGE_IMTEXT_TL';
841 
842          IF NOT( l_idx_status = 'INDEXED' ) THEN
843             Log_Line (l_api_name || ': Error: Index status is ' || l_idx_status || '.');
844             l_return_status := G_STATUS_ERROR;
845          END IF;
846 
847          IF ( NVL(l_idx_docid_count, 0) = 0 ) THEN
848             Log_Line (l_api_name || ': Error: Indexed document count is ' || TO_CHAR(l_idx_docid_count) || '.');
849             l_return_status := G_STATUS_ERROR;
850          END IF;
851 
852          IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
853             RAISE G_EXC_ERROR;
854          END IF;
855 
856 
857 
858    END IF;  -- build index
859 
860    x_return_status := l_return_status;
861    Log_Line (l_api_name || ': end');
862 
863 EXCEPTION
864 
865    WHEN G_EXC_ERROR THEN
866       x_return_status := G_STATUS_ERROR;
867 
868    WHEN others THEN
869       Log_Line (l_api_name || ': Error: ' || SQLERRM);
870       x_return_status := G_STATUS_UNEXP_ERROR;
871 
872 END Process_Change_Text_Index;
873 
874 -- -----------------------------------------------------------------------------
875 --			     Build_Change_Text_Index
876 -- -----------------------------------------------------------------------------
877 
878 PROCEDURE Build_Change_Text_Index
879 (
880    ERRBUF		OUT  NOCOPY  VARCHAR2
881 ,  RETCODE		OUT  NOCOPY  NUMBER
882 ,  p_Action		IN           VARCHAR2
883 )
884 IS
885    l_api_name		CONSTANT  VARCHAR2(30)  :=  'Build_Change_Text_Index';
886    l_Index_Name			VARCHAR2(30)    :=  'ENG_CHANGE_IMTEXT_TL_CTX1';
887    l_return_status		VARCHAR2(1);
888 BEGIN
889    Log_Line (l_api_name || ': begin: Action=' || p_Action);
890 
891    IF ( g_Log_Mode IS NULL ) THEN
892       set_Log_Mode ('FILE');
893    END IF;
894 
895    l_return_status := G_STATUS_SUCCESS;
896 
897    IF ( p_Action IN ('CREATE', 'REBUILD', 'UPGRADE') ) THEN
898       Log_Line (l_api_name || ': calling Process_Index_Preferences ...');
899 
900       Process_Index_Preferences
901       (
902          p_Index_Name     =>  l_Index_Name
903       ,  x_return_status  =>  l_return_status
904       );
905 
906       IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
907          RAISE G_EXC_ERROR;
908       END IF;
909 
910       Out_Line ('Re-created Text Index preferences.');
911    END IF;
912 
913    Log_Line (l_api_name || ': calling Process_Change_Text_Index ...');
914 
915    Process_Change_Text_Index
916    (
917       p_Index_Name     =>  l_Index_Name
918    ,  p_Action         =>  p_Action
919    ,  x_return_status  =>  l_return_status
920    );
921 
922    IF ( l_return_status NOT IN (G_STATUS_SUCCESS, G_STATUS_WARNING) ) THEN
923       RAISE G_EXC_ERROR;
924    END IF;
925 
926    -- Assign conc request return code
927 
928    IF ( l_return_status = G_STATUS_SUCCESS ) THEN
929       RETCODE := G_RETCODE_SUCCESS;
930       ERRBUF  := FND_MESSAGE.Get_String('EGO', 'EGO_CP_SUCCESS');
931    ELSIF ( l_return_status = G_STATUS_WARNING ) THEN
932       RETCODE := G_RETCODE_WARNING;
933       ERRBUF  := FND_MESSAGE.Get_String('EGO', 'EGO_CP_WARNING');
934    ELSE
935       RETCODE := G_RETCODE_ERROR;
936       ERRBUF  := FND_MESSAGE.Get_String('EGO', 'EGO_CP_FAILURE');
937    END IF;
938 
939    IF NOT(g_Conc_Req_flag) THEN
940       FND_FILE.Close;
941    END IF;
942 
943    Log_Line (l_api_name || ': end');
944 
945 EXCEPTION
946 
947    WHEN G_EXC_ERROR THEN
948       Log_Line (l_api_name || ': Error.');
949       RETCODE := G_RETCODE_ERROR;
950       ERRBUF  := FND_MESSAGE.Get_String('EGO', 'EGO_CP_FAILURE');
951       --ERRBUF  := 'Build of CM Text Index failed. Please check error messages for further details.';
952 
953       IF NOT(g_Conc_Req_flag) THEN
954          FND_FILE.Close;
955       END IF;
956 
957    WHEN others THEN
958       Log_Line (l_api_name || ': Unexpected Error: ' || SQLERRM);
959       RETCODE := G_RETCODE_ERROR;
960       ERRBUF  := 'Build of CM Text Index failed due to unexpected error. Please check error messages for further details.';
961 
962       IF NOT(g_Conc_Req_flag) THEN
963          FND_FILE.Close;
964       END IF;
965 
966 END Build_Change_Text_Index;
967 
968 
969 -- -----------------------------------------------------------------------------
970 --				  get_Msg_Text
971 -- -----------------------------------------------------------------------------
972 
973 FUNCTION get_Msg_Text
974 RETURN VARCHAR2
975 IS
976 BEGIN
977    RETURN (g_Msg_Text);
978 END get_Msg_Text;
979 
980 -- *****************************************************************************
981 -- **                      Package initialization block                       **
982 -- *****************************************************************************
983 
984 BEGIN
985 
986    -- Get ENG product schema name
987    --
988    g_installed := FND_INSTALLATION.Get_App_Info ('ENG', g_inst_status, g_industry, g_Prod_Schema);
989 
990    g_Index_Owner := g_Prod_Schema;
991    g_Pref_Owner  := g_Prod_Schema;
992 
993 END ENG_CHANGE_TEXT_PVT;