DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_CONTEXT_UTIL

Source


1 package body FND_CONTEXT_UTIL as
2 /* $Header: AFCPCTUB.pls 120.2 2005/08/19 19:43:09 tkamiya ship $ */
3 
4   --
5   -- PUBLIC VARIABLES
6   --
7 
8 
9   -- Exceptions
10 
11   -- Exception Pragmas
12 
13   --
14   -- PUBLIC FUNCTIONS
15   --
16 
17   --
18   -- Name
19   --   get_tag_value
20   -- Purpose
21   --   get_tag_value returns value for a variable from context_file
22   --
23   -- Parameters:
24   --   node_name  - name of the node for which you want to get the variable
25   --                value
26   --   tag_name   - name of the tag from context file for which you want to
27   --                get value.
28   --
29   --                tag_name - 'pathsep' or 'platform'
30   --
31   function get_tag_value(node_name  in varchar2,
32 		         tag_name   in varchar2) return varchar2 is
33     lobd        CLOB;
34     start_pos   INTEGER;
35     end_pos     INTEGER;
36     ret_string  varchar2(200);
37     path_value  varchar2(200);
38 
39   begin
40     SELECT text INTO lobd
41       FROM fnd_oam_context_files
42      WHERE upper(node_name) = upper(get_tag_value.node_name)
43        and status in ('S','F')
44        and name not in ('METADATA', 'TEMPLATE')
45        and ctx_type = 'A'
46        and rownum=1;
47 
48     start_pos := DBMS_LOB.instr(lobd, '<' || tag_name, 1,1);
49     end_pos := DBMS_LOB.instr(lobd, '</' || tag_name, 1,1);
50 
51     ret_string := dbms_lob.substr(lobd, end_pos - start_pos, start_pos);
52 
53     ret_string := substr(ret_string,instr(ret_string,'>',1,1)+1);
54 
55      return ret_string;
56 
57     exception
58        when others then
59             fnd_message.set_name ('FND', 'SQL-Generic error');
60             fnd_message.set_token ('ERRNO', sqlcode, FALSE);
61             fnd_message.set_token ('REASON', sqlerrm, FALSE);
62             fnd_message.set_token ('ROUTINE',
63                                    'FND_CONTEXT_UTIL.GET_TAG_VALUE',
64                                    FALSE);
65             if (FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
66             fnd_log.message(FND_LOG.LEVEL_EXCEPTION,
67                             'fnd.plsql.FND_CONTEXT_UTIL.GET_TAG_VALUE.others',
68                             FALSE);
69             end if;
70             return null;
71   end;
72 
73 
74  end FND_CONTEXT_UTIL;