1 PACKAGE BODY Pa_Debug AS
2 /* $Header: PADEBUGB.pls 120.5 2006/04/28 03:41:17 cmishra noship $ */
3
4 -- Initialize PROCEDURE
5
6 PROCEDURE initialize IS
7 BEGIN
8 NULL;
9
10 EXCEPTION
11 WHEN OTHERS THEN
12 RAISE;
13 END initialize;
14
15 PROCEDURE enable_debug IS
16 BEGIN
17 debug_flag := TRUE;
18 debug_level:= DEBUG_LEVEL_BASIC;
19 END enable_debug;
20
21 PROCEDURE enable_debug (x_debug_level IN NUMBER) IS
22 BEGIN
23 debug_flag := TRUE;
24 debug_level := x_debug_level;
25 END enable_debug;
26
27 PROCEDURE disable_debug IS
28 BEGIN
29 debug_flag := FALSE;
30 END disable_debug;
31
32 PROCEDURE set_debug_level (x_debug_level IN NUMBER) IS
33 BEGIN
34 debug_level := x_debug_level;
35 END set_debug_level;
36
37 PROCEDURE DEBUG (x_debug_message IN VARCHAR2) IS
38 rest VARCHAR2(32767);
39 BEGIN
40 IF (debug_flag AND x_debug_message IS NOT NULL) THEN
41 IF ( debug_level = DEBUG_LEVEL_TIMING) THEN
42 rest := TO_CHAR(SYSDATE, 'DD-MON-YYYY HH:MI:SS ') || x_debug_message;
43 ELSE
44 rest := x_debug_message;
45 END IF;
46 LOOP
47 IF (rest IS NULL) THEN
48 EXIT;
49 ELSE
50 number_of_debug_messages := number_of_debug_messages + 1;
51 debug_message(number_of_debug_messages) := SUBSTRB(rest,1,255);
52 rest := SUBSTRB(rest, 256);
53 END IF; -- IF (rest IS NULL)
54 END LOOP;
55 END IF; -- IF (debug_flag)
56 END DEBUG;
57
58 PROCEDURE DEBUG (x_debug_message IN VARCHAR2, x_debug_level IN NUMBER) IS
59 old_debug_flag BOOLEAN;
60 BEGIN
61 IF ( debug_level >= x_debug_level ) THEN
62 IF ( x_debug_level = DEBUG_LEVEL_EXCEPTION ) THEN
63 old_debug_flag := debug_flag;
64 debug_flag := TRUE;
65 DEBUG(x_debug_message);
66 debug_flag := old_debug_flag;
67 ELSE
68 DEBUG(x_debug_message);
69 END IF;
70 END IF;
71 END DEBUG;
72
73 PROCEDURE get_message(x_message_number IN NUMBER,
74 x_debug_message OUT NOCOPY VARCHAR2) IS --File.Sql.39 bug 4440895
75 BEGIN
76 IF (x_message_number > 0 ) THEN
77 x_debug_message := debug_message(x_message_number);
78 END IF;
79 END get_message;
80
81 FUNCTION no_of_debug_messages RETURN NUMBER IS
82 BEGIN
83 RETURN number_of_debug_messages;
84 END no_of_debug_messages;
85 --------------------------------------------------------------------
86 /* APIs for handling processes, errors, named locks */
87 --------------------------------------------------------------------
88
89 PROCEDURE Set_User_Lock_Mode ( x_Lock_Mode IN NUMBER DEFAULT 6,
90 x_Commit_Mode IN BOOLEAN DEFAULT FALSE,
91 x_TimeOut IN NUMBER DEFAULT 0 )
92 IS
93 BEGIN
94
95 G_LockMode := NVL(x_Lock_Mode,6);
96 G_CommitMode := NVL(x_Commit_Mode,FALSE);
97 G_TimeOut := NVL(x_TimeOut,0);
98
99 END Set_User_Lock_Mode;
100
101
102 ----------------------------------------------------------------
103 /** Acquire_User_Lock : Function to acquire a user lock.
104 x_lock_name : name of the lock.
105 x_lock_mode : Mode of the lock ( Exclusive,..)
106 x_commit_mode : Rls with commit or not
107 Returns : 0 if successful in acquiring lock
108 : < 0 ( -1 to -5) if error in requesting lock (error status)
109 : -99 if unable to allocate unique handle for the lock
110 Ora Errors are not handled
111 **/
112
113
114 FUNCTION Acquire_User_Lock ( x_Lock_Name IN VARCHAR2,
115 x_Lock_Mode IN NUMBER ,
116 x_Commit_Mode IN BOOLEAN,
117 x_TimeOut IN NUMBER )
118 RETURN NUMBER
119 IS
120 lstatus NUMBER;
121 lockhndl VARCHAR2(128);
122 lTimeOut NUMBER; /* Bug#2289946 */
123
124 BEGIN
125
126 /* If Lock Name is NULL then return -99 */
127
128 IF (x_Lock_Name IS NULL ) THEN
129 RETURN -99;
130 END IF;
131
132 /* Bug#2289946 -- Start */
133 IF x_TimeOut = 0 THEN
134 lTimeOut := 864000;
135 ELSE
136 lTimeOut := x_TimeOut;
137 END IF;
138 /* Bug#2289946 -- End */
139
140
141 /* get lock handle for user lock */
142
143 -- dbms_lock.allocate_unique(x_lock_name,lockhndl,G_TimeOut); /* Bug#2289946 */
144
145 dbms_lock.allocate_unique(x_lock_name,lockhndl,lTimeOut); /* Bug#2289946 */
146
147 IF ( lockhndl IS NOT NULL ) THEN
148 /* Get the lock, do not release the lock on commit */
149
150 lstatus := dbms_lock.request(lockhndl,
151 NVL(x_lock_mode,G_LockMode),
152 G_TimeOut,
153 NVL(x_commit_mode,G_CommitMode));
154
155 IF ( lstatus = 0 ) THEN /* Got the lock */
156 RETURN 0;
157 ELSE
158 RETURN (-1*lstatus);/* Return the status obtained on request */
159 END IF;
160 ELSE
161 RETURN -99; /* Failed to allocate lock */
162 END IF;
163
164 END Acquire_User_Lock;
165
166 FUNCTION Acquire_User_Lock ( x_Lock_Name IN VARCHAR2)
167 RETURN NUMBER
168 IS
169 BEGIN
170
171 RETURN Acquire_User_Lock( x_Lock_Name,G_LockMode,G_CommitMode,G_TimeOut
172 );
173
174 END Acquire_User_Lock;
175
176
177 ------------------------------------------------------------------
178 /** Release_User_Lock : Function to release user lock.
179 x_Lock_Name : The lock name to release
180 Returns :0 - success,
181 :< 0 - Error.
182 Ora Errors are not handled
183 **/
184
185
186 FUNCTION Release_User_Lock ( x_Lock_Name IN VARCHAR2 )
187 RETURN NUMBER
188 IS
189 lstatus NUMBER;
190 lockhndl VARCHAR2(128);
191 lTimeOut NUMBER; /* Bug#2289946 */
192
193 BEGIN
194
195 /* If Lock Name is NULL then return -99 */
196
197 IF (x_Lock_Name IS NULL ) THEN
198 RETURN -99;
199 END IF;
200
201 /* Bug#2289946 -- Start */
202 IF G_TimeOut = 0 THEN
203 lTimeOut := 864000;
204 ELSE
205 lTimeOut := G_TimeOut;
206 END IF;
207 /* Bug#2289946 -- End */
208
209 /* get lock handle for user lock */
210
211 -- dbms_lock.allocate_unique(x_lock_name,lockhndl,G_TimeOut); /* Bug#2289946 */
212
213 dbms_lock.allocate_unique(x_lock_name,lockhndl,lTimeOut); /* Bug#2289946 */
214
215 IF ( lockhndl IS NOT NULL ) THEN
216 /* Release the Lock */
217
218 lstatus := dbms_lock.RELEASE(lockhndl);
219
220 IF ( lstatus = 0 ) THEN /* Lock Released */
221 RETURN 0;
222 ELSE
223 RETURN (-1*lstatus);/* Return the status obtained on release */
224 END IF;
225 ELSE
226 RETURN -99; /* Failed to allocate lock */
227 END IF;
228
229 END Release_User_Lock;
230
231 ------------------------------------------------------------------
232 PROCEDURE Set_Process ( x_Process IN VARCHAR2, -- 1851096
233 x_Write_File IN VARCHAR2 DEFAULT 'LOG',
234 x_Debug_Mode IN VARCHAR2 DEFAULT 'N' )
235 IS
236
237 BEGIN
238 SELECT DECODE(x_Process,'PLSQL','PLSQL','SQL','SQL','REPORT',
239 'REPORT','FORM','FORM','PLSQL'),
240 DECODE(x_Write_File,'LOG','LOG','OUT','OUT','LOG')
241 INTO G_Process, G_WriteFile
242 FROM dual;
243
244 IF (x_Debug_Mode = 'Y') THEN
245 Enable_Debug;
246 ELSE
247 Disable_Debug;
248 END IF;
249
250 IF (G_Process = 'PLSQL') THEN
251 SELECT DECODE(G_WriteFile,'LOG',Fnd_File.LOG,Fnd_File.OUTPUT )
252 INTO G_WriteFileID
253 FROM dual;
254 ELSIF (G_Process = 'REPORT') THEN
255 Enable_Debug; /* If REPORT is used, then need to enable debug */
256 ELSIF (G_Process = 'FORM') THEN
257 Enable_Debug;
258 number_of_debug_messages := 0;
259 END IF;
260
261 END Set_Process;
262 ---------------------------------------------------------------------
263 PROCEDURE Write_File ( x_Write_File IN VARCHAR2,
264 x_Msg IN VARCHAR2,
265 x_Write_Mode IN NUMBER DEFAULT 0)
266 IS
267 rest VARCHAR2(32767);
268 rest1 VARCHAR2(32767);
269 l_log_level NUMBER :=6;
270
271 BEGIN
272 /* Write only if mandatory : Write_Mode = 1
273 OR Optional for Debug : Write_Mode = 0 and Debug flag */
274
275 rest := x_msg;
276
277 IF (x_Write_Mode <> 0 OR (x_Write_Mode = 0 AND Debug_Flag )) THEN
278 LOOP
279 IF (rest IS NULL) THEN
280 EXIT;
281 ELSE
282 rest1 := SUBSTRB(rest,1,255);
283 rest := SUBSTRB(rest, 256);
284 END IF; -- IF (rest IS NULL)
285
286 IF G_Process = 'PLSQL' THEN
287 IF NVL(x_Write_File,G_WriteFile) = 'OUT' THEN
288 Fnd_File.PUT(Fnd_File.OUTPUT,rest1);
289 Fnd_File.NEW_LINE(Fnd_File.OUTPUT);
290 ELSIF NVL(x_Write_File,G_WriteFile) = 'LOG' THEN
291 Fnd_File.PUT(Fnd_File.LOG,rest1);
292 Fnd_File.NEW_LINE(Fnd_File.LOG);
293 IF (l_log_level >= Fnd_Log.G_CURRENT_RUNTIME_LEVEL) THEN -- by GSCC standard we have to checkt the level
294 Fnd_Log.STRING(l_log_level,'Concurrent Request ID:'|| x_request_id,x_Msg);
295 END IF;
296 ELSE
297 Fnd_File.PUT(G_WriteFileID,rest1);
298 Fnd_File.NEW_LINE(G_WriteFileID);
299 END IF;
300 ELSIF G_Process = 'SQL' THEN
301 /* DBMS_OUTPUT.PUT_LINE(rest1); */
302 NULL;
303 ELSIF G_Process = 'IGNORE' THEN
304 NULL;
305 ELSE /* This applies to REPORT and FORM */
306 DEBUG(rest1);
307 END IF;
308 END LOOP;
309 END IF;
310
311 EXCEPTION
312
313 WHEN UTL_FILE.INVALID_PATH THEN
314 RAISE_APPLICATION_ERROR(-20010,'INVALID PATH exception from UTL_FILE !!'
315 || G_Err_Stack ||' - '||G_Err_Stage);
316
317 WHEN UTL_FILE.INVALID_MODE THEN
318 RAISE_APPLICATION_ERROR(-20010,'INVALID MODE exception from UTL_FILE !!'
319 || G_Err_Stack ||' - '||G_Err_Stage);
320
321 WHEN UTL_FILE.INVALID_FILEHANDLE THEN
322 RAISE_APPLICATION_ERROR(-20010,'INVALID FILEHANDLE exception from UTL_FILE !!'
323 || G_Err_Stack ||' - '||G_Err_Stage);
324
325 WHEN UTL_FILE.INVALID_OPERATION THEN
326 RAISE_APPLICATION_ERROR(-20010,'INVALID OPERATION exception from UTL_FILE !!'
327 || G_Err_Stack ||' - '||G_Err_Stage);
328
329 WHEN UTL_FILE.READ_ERROR THEN
330 RAISE_APPLICATION_ERROR(-20010,'READ ERROR exception from UTL_FILE !!'
331 || G_Err_Stack ||' - '||G_Err_Stage);
332
333 WHEN UTL_FILE.WRITE_ERROR THEN
334 RAISE_APPLICATION_ERROR(-20010,'WRITE ERROR exception from UTL_FILE !!'
335 || G_Err_Stack ||' - '||G_Err_Stage);
336
337 WHEN UTL_FILE.INTERNAL_ERROR THEN
338 RAISE_APPLICATION_ERROR(-20010,'INTERNAL ERROR exception from UTL_FILE !!'
339 || G_Err_Stack ||' - '||G_Err_Stage);
340
341 END Write_File;
342 ---------------------------------------------------------------------
343 PROCEDURE Write_File( x_Msg IN VARCHAR2,
344 x_Write_Mode IN NUMBER DEFAULT 0 )
345 IS
346 BEGIN
347 Write_File( G_WriteFile, x_Msg, x_Write_Mode ) ;
348 END Write_File;
349 ---------------------------------------------------------------------
350
351 -- This procedure is deprecated. Please use PA_DEBUG.WRITE.
352 PROCEDURE Write_Log ( x_Module IN VARCHAR2,
353 x_Msg IN VARCHAR2,
354 x_Log_Level IN NUMBER DEFAULT 6 )
355 IS
356 -- OA changed their log level mapping so we have changed this method to use
357 -- the new mapping.
358 l_new_log_level NUMBER;
359 BEGIN
360 IF (x_log_level = 4 OR x_log_level = 6) THEN
361 l_new_log_level := 3;
362 ELSIF (x_log_level = 7) THEN
363 l_new_log_level := 5;
364 ELSE
365 l_new_log_level := 1;
366 END IF;
367
368 -- Added if condition for Bug 4271360
369 IF (l_new_log_level >= Fnd_Log.G_CURRENT_RUNTIME_LEVEL) THEN
370 Fnd_Log.STRING(l_new_log_level,x_Module,x_Msg);
371 END IF;
372 -- End Bug 4271360
373 END Write_Log;
374 ----------------------------------------------------------------------
375 -- x_module: ex. pa.plsql.pa_timeline_pvt
376 -- x_msg: Message
377 -- x_Log_Level: 6 - Unexpected Errors
378 -- 5 - Expected Errors
379 -- 4 - Exception
380 -- 3 - Event (High Level Logging Message)
381 -- 2 - Procedure (Entry / Exit from a routine)
382 -- 1 - Statement - (Low Level Logging Message)
383 --
384 PROCEDURE WRITE (
385 x_Module IN VARCHAR2,
386 x_Msg IN VARCHAR2,
387 x_Log_Level IN NUMBER DEFAULT 1 )
388 IS
389 BEGIN
390 -- Added if condition for Bug 4271360
391 IF (x_Log_Level >= Fnd_Log.G_CURRENT_RUNTIME_LEVEL) THEN
392 Fnd_Log.STRING(x_log_level,x_Module,x_Msg);
393 END IF;
394 -- End Bug 4271360
395 END WRITE;
396
397 ----------------------------------------------------------------------
398 PROCEDURE Init_Err_Stack ( x_Stack IN VARCHAR2 )
399 IS
400 BEGIN
401 G_Err_Ind := 1;
402 G_Err_Stack_Tbl(1) := x_Stack;
403 G_Err_Stack := x_Stack;
404
405 END Init_Err_Stack;
406 -----------------------------------------------------------------
407 PROCEDURE Set_Err_Stack ( x_Stack IN VARCHAR2 )
408 IS
409 BEGIN
410 /* Bug 5064900 : As max length of G_Err_Stack is 2000 , nothing is appended to G_Err_Stack if total length becomes greater than 2000. */
411 If (length(G_Err_Stack || '->' || x_Stack) <= 2000) then
412 G_Err_Stack := G_Err_Stack || '->'||x_Stack;
413 end if;
414 END Set_Err_Stack;
415 -----------------------------------------------------------------
416 PROCEDURE Reset_Err_Stack
417 IS
418 BEGIN
419 G_err_stack := SUBSTR(G_err_stack, 1, INSTR(G_err_stack,'->',-1,1)-1) ;
420 END Reset_Err_Stack;
421 ------------------------------------------------------------------
422
423 PROCEDURE raise_error(x_Msg_Num IN NUMBER ,
424 x_Msg IN VARCHAR2 ,
425 x_TokenName1 IN VARCHAR2 ,
426 x_Token1 IN VARCHAR2 ,
427 x_TokenName2 IN VARCHAR2 ,
428 x_Token2 IN VARCHAR2 ,
429 x_TokenName3 IN VARCHAR2 ,
430 x_Token3 IN VARCHAR2 )
431 IS
432
436 Fnd_Message.set_token(x_TokenName2, x_Token2);
433 BEGIN
434 Fnd_Message.set_name('PA', x_msg);
435 Fnd_Message.set_token(x_TokenName1, x_Token1);
437 Fnd_Message.set_token(x_TokenName3, x_Token3);
438
439 RAISE_APPLICATION_ERROR(x_Msg_Num,Fnd_Message.get);
440
441 END raise_error;
442
443 -------------------------------------------------------------------
444 PROCEDURE raise_error(x_Msg_Num IN NUMBER ,
445 x_Msg IN VARCHAR2 ,
446 x_TokenName1 IN VARCHAR2 ,
447 x_Token1 IN VARCHAR2 ,
448 x_TokenName2 IN VARCHAR2 ,
449 x_Token2 IN VARCHAR2 )
450 IS
451
452 BEGIN
453 Fnd_Message.set_name('PA', x_msg);
454 Fnd_Message.set_token(x_TokenName1, x_Token1);
455 Fnd_Message.set_token(x_TokenName2, x_Token2);
456
457 RAISE_APPLICATION_ERROR(x_Msg_Num,Fnd_Message.get);
458
459 END raise_error;
460
461 -------------------------------------------------------------------
462 PROCEDURE raise_error(x_Msg_Num IN NUMBER ,
463 x_Msg IN VARCHAR2 ,
464 x_TokenName1 IN VARCHAR2 ,
465 x_Token1 IN VARCHAR2 )
466 IS
467
468 BEGIN
469 Fnd_Message.set_name('PA', x_msg);
470 Fnd_Message.set_token(x_TokenName1, x_Token1);
471
472 RAISE_APPLICATION_ERROR(x_Msg_Num,Fnd_Message.get);
473
474 END raise_error;
475
476 -------------------------------------------------------------------
477 PROCEDURE raise_error(x_Msg_Num IN NUMBER ,
478 x_Msg IN VARCHAR2 )
479 IS
480
481 BEGIN
482 Fnd_Message.set_name('PA', x_msg);
483
484 RAISE_APPLICATION_ERROR(x_Msg_Num,Fnd_Message.get);
485
486 END raise_error;
487
488 -------------------------------------------------------------------
489
490
491 --Name: Log_Message
492 --Type: Procedure
493 --Description: This procedure writes sysdate date and time, the
494 -- current procedure name and the passed message
495 -- to the log file.
496 --
497 --Called subprograms: pa_debug.write_file
498 --
499 --History:
500 -- 29-NOV-00 jwhite Cloned
501 --
502 -- 07-DEC-00 jwhite Added the p_msg_options IN parameter
503 -- to give the developer more
504 -- options for the log message
505 -- format:
506 --
507 -- 1. PLAIN: prints the p_message
508 -- as is. This is the default.
509 -- 2. TIME: prints HH24:MI:SS, space,
510 -- function name,:, p_message.
511 -- 3. DATETIME: prints YYYY/MM/DD HH24:MI:SS,
512 -- space, function name,:, p_message.
513 --
514 -- PLEASE NOTE: If you place a pa_debug.log_message with either
515 -- the TIME or DATETIME p_msg_option just
516 -- before a SQL%ROWCOUNT,
517 -- the SQL%ROWCOUNT will return 1.
518 --
519 -- 11-DEC-00 jwhite For log_message, modified code to only
520 -- print function name for log file.
521 --
522
523 PROCEDURE Log_Message( p_message IN VARCHAR2
524 , p_write_mode IN NUMBER DEFAULT 0
525 , p_msg_options IN VARCHAR2 DEFAULT 'PLAIN'
526 , p_write_file IN VARCHAR2 DEFAULT 'LOG'
527 )
528 IS
529
530 l_function VARCHAR2(50) := NULL;
531
532 BEGIN
533
534 IF (G_Function_Stack.EXISTS(G_Function_Counter))
535 THEN
536 l_function := G_Function_Stack(G_Function_Counter);
537 END IF;
538
539
540 IF (p_write_file = 'LOG')
541 THEN
542 -- Print Function Name
543 IF (p_msg_options = 'PLAIN')
544 THEN
545 Pa_Debug.write_file(p_write_file, g_space ||
546 l_function || ': ' ||p_message, p_write_mode);
547
548 ELSIF (p_msg_options = 'TIME')
549 THEN
550 Pa_Debug.write_file(p_write_file,
551 TO_CHAR(SYSDATE,'HH24:MI:SS') || g_space ||
552 l_function || ': ' ||p_message, p_write_mode);
553 ELSE
554 -- Treat as DATETIME, including illegal values.
555 Pa_Debug.write_file(p_write_file,
556 TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS') || g_space ||
557 l_function || ': ' ||p_message, p_write_mode);
558 END IF;
559
560 ELSE
561 -- Do Not Print Function Name
562 IF (p_msg_options = 'PLAIN')
563 THEN
564 Pa_Debug.write_file(p_write_file, g_space ||p_message, p_write_mode);
565
566 ELSIF (p_msg_options = 'TIME')
567 THEN
568 Pa_Debug.write_file(p_write_file,
569 TO_CHAR(SYSDATE,'HH24:MI:SS') || g_space ||p_message, p_write_mode);
570 ELSE
571 -- Treat as DATETIME, including illegal values.
572 Pa_Debug.write_file(p_write_file,
573 TO_CHAR(SYSDATE,'YYYY/MM/DD HH24:MI:SS') || g_space ||p_message, p_write_mode);
574 END IF;
575 END IF;
576
577 EXCEPTION
578
579 WHEN OTHERS
580 THEN
581 RAISE;
582
583 END log_message;
584
585 -------------------------------------------------------------------
586 --Name: Set_Curr_Function
587 --Type: Procedure
588 --Description: This procedure conditionally calls either
589 -- the init_err_stack and set_process procedures
590 -- or the set_err_stack procedure. See the aforementioned
591 -- procedures for more information about their
592 -- functionality.
593 --
594 -- With respect to the set_err_stack procedure, this
595 -- procedure extends the functionality of the
596 -- set_err_stack procedure by nesting subroutine messages
597 -- within the overall program flow.
598 --
599 --
600 --Called subprograms: pa_debug.init_err_stack
601 -- pa_debug.set_process
602 -- pa_debug.set_err_stack
603 --
604 --History:
605 -- 29-NOV-00 jwhite Cloned
606 --
607
608 PROCEDURE Set_Curr_Function(p_function IN VARCHAR2
609 , p_process IN VARCHAR2 DEFAULT 'PLSQL'
610 , p_write_file IN VARCHAR2 DEFAULT 'LOG'
611 , p_debug_mode IN VARCHAR2 DEFAULT 'N'
612 )
613 IS
614 BEGIN
615
616 G_Function_Counter := G_Function_Counter + 1;
617 G_Function_Stack(G_Function_Counter) := p_function;
618 G_Space := G_Space || ' ';
619
620 IF ( G_Function_Counter = 1)
621 THEN
622 Pa_Debug.init_err_stack(p_function);
623 Pa_Debug.set_process (p_process, p_write_file, p_debug_mode);
624 ELSE
625 Pa_Debug.set_err_stack(p_function);
626 END IF;
627
628 END Set_Curr_Function;
629
630 -------------------------------------------------------------------
631 --Name: Reset_Curr_Function
632 --Type: Procedure
633 --Description: This procedure removes the current procedure
634 -- or function name from the error stack. This
635 -- procedure also adjusts the global for
636 -- indentation, accordingly.
637 --
638 --Called subprograms: pa_debug.reset_err_stack
639 --
640 --History:
641 -- 29-NOV-00 jwhite Cloned
642 --
643
644 PROCEDURE Reset_Curr_Function
645 IS
646 BEGIN
647
648 G_Function_Stack.DELETE(G_Function_Counter);
649 G_Function_Counter := G_Function_Counter -1;
650 G_Space := SUBSTR(G_Space,1,LENGTH(G_Space)-2);
651 Pa_Debug.reset_err_stack;
652
653 END Reset_Curr_Function;
654
655 -- =======================================================================
656 -- Start of Comments
657 -- API Name : TrackPath
658 -- Pre-Reqs : None
659 -- Type : Procedure
660 -- Function : This procedure tracks the path thru the code to attach to error messages.
661 --
662 -- Parameters:
663 --
664 -- IN
665 -- P_Function - VARCHAR2(10) -- ADD or STRIP
666 -- P_Value - VARACHAR2(100)
667 --
668
669 /*-------------------------------------------------------------------------*/
670
671 PROCEDURE TrackPath (
672 P_Function IN VARCHAR2,
673 P_Value IN VARCHAR2)
674
675 IS
676
677 l_Value VARCHAR2(2000) := '->' || P_Value;
678
679 BEGIN
680
681 Pa_Debug.G_Stage := 'Entering procedure TrackPath().';
682
683 IF P_Function = 'ADD' THEN
684
685 Pa_Debug.G_Stage := 'TrackPath(): Adding to Pa_Debug.G_Path.';
686 Pa_Debug.G_Path := Pa_Debug.G_Path || l_Value;
687
688 ELSIF P_Function = 'STRIP' THEN
689
690 Pa_Debug.G_Stage := 'TrackPath(): Stripping from Pa_Debug.G_Path.';
691 Pa_Debug.G_Path := SUBSTR(Pa_Debug.G_Path,1,INSTR(Pa_Debug.G_Path,l_Value) - 1);
692
693 END IF;
694
695 Pa_Debug.G_Stage := 'Leaving procedure TrackPath().';
696
697 EXCEPTION
698 WHEN OTHERS THEN
699 RAISE;
700
701 END TrackPath;
702
703 END Pa_Debug;