DBA Data[Home] [Help]

PACKAGE BODY: APPS.CN_COLLECT_CUSTOM

Source


1 PACKAGE BODY CN_COLLECT_CUSTOM AS
2 -- $Header: cncocub.pls 120.6 2006/01/18 03:45:51 apink noship $
3 
4 --
5 -- Procedure Name
6 --   collect
7 -- Purpose
8 --   This procedure calls the correct collections package for the
9 --   specified data source
10 --
11 -- History
12 --   03-Apr-00       D.Maskell       Created
13 --
14 
15 
16 PROCEDURE collect (x_errbuf     OUT NOCOPY VARCHAR2,
17 		         x_retcode      OUT NOCOPY NUMBER,
18 		         p_table_map_id IN NUMBER
19                   ) -- Added as part of MOAC Changes
20                  IS
21 
22   package_name      cn_objects.name%TYPE;
23   dummy_vch         VARCHAR2(2);
24   dummy_num         NUMBER;
25   c                 INTEGER;
26   rows_processed    INTEGER;
27   statement         VARCHAR2(1000);
28   x_org_id          NUMBER;
29 
30 
31 BEGIN
32 
33   x_org_id := mo_global.get_current_org_id;
34 
35   --+
36   -- Get the name of the collection package
37   --+
38   MO_GLOBAL.SET_POLICY_CONTEXT ('S',x_org_id);
39   SELECT OBJ.name
40   INTO   package_name
41   FROM   cn_table_map_objects tmov, cn_objects obj
42   WHERE  tmov.table_map_id = p_table_map_id
43   and obj.object_id = tmov.object_id
44          AND tmov.tm_object_type = 'PKS'
45          and tmov.org_id = obj.org_id
46          AND tmov.org_id = x_org_id;
47   --+
48   -- Construct the call to the collect procedure of the package
49   --+
50   statement := 'BEGIN '||package_name||'.collect(:err,:ret,:orgid); END;';
51 --dbms_output.put_line('cn_collect_custom: Procedure Call = '||statement);
52 
53   --+
54   -- Use dynamic SQL to run the statement
55   --+
56   c := dbms_sql.open_cursor;
57 
58   dbms_sql.parse(c, statement, dbms_sql.native);
59 
60   dbms_sql.bind_variable(c,'err', dummy_vch, 30);
61   dbms_sql.bind_variable(c,'ret', dummy_num);
62   dbms_sql.bind_variable(c,'orgid', x_org_id);
63 
64   rows_processed := dbms_sql.execute(c);
65 
66   dbms_sql.variable_value(c,'err', x_errbuf);
67   dbms_sql.variable_value(c,'ret', x_retcode);
68 
69   dbms_sql.close_cursor(c);
70 
71 END collect;
72 
73 END cn_collect_custom;