DBA Data[Home] [Help]

PACKAGE: SYS.DBMS_REPORT

Source


1 PACKAGE dbms_report AUTHID CURRENT_USER IS
2   --=========================================================================--
3   --                             GLOBAL TYPES                                --
4   --=========================================================================--
5   TYPE string_number_map IS TABLE OF NUMBER INDEX BY VARCHAR2(32767);
6 
7   --=========================================================================--
8   --                           GLOBAL CONSTANTS                              --
9   --=========================================================================--
10 
11   -- date format from flex
12   -- date_fmt_mod is used when generating/checking the URL parameters
13   DATE_FMT_MOD          CONSTANT       varchar2(21) := 'mm:dd:yyyy hh24:mi:ss';
14   -- date_fmt is used for any dates printed out and can be consumed
15   -- by flex Formatter.dateXML()
16   DATE_FMT              CONSTANT       varchar2(21) := 'mm/dd/yyyy hh24:mi:ss';
17 
18   -- Content type constants (used by servlet, stored in wri$_rept_formats)
19   CONTENT_TYPE_XML      CONSTANT        NUMBER := 1;
20   CONTENT_TYPE_HTML     CONSTANT        NUMBER := 2;
21   CONTENT_TYPE_TEXT     CONSTANT        NUMBER := 3;
22   CONTENT_TYPE_BINARY   CONSTANT        NUMBER := 4;
23 
24   -- Directory name that clients use passing for their files
25   SHARED_DIRECTORY_OBJECT       CONSTANT VARCHAR2(64) := 'ORAREP_DIR';
26 
27   --=========================================================================--
28   --                                 TYPES                                   --
29   --=========================================================================--
30   TYPE ref_string_idspec IS TABLE OF VARCHAR2(32767) INDEX BY VARCHAR2(32767);
31 
32   -- record for storing canonical values of certain parameters we wish to
33   -- set before any report is generated. These parameters influence the way
34   -- data is formatted in the reports and the canonical values will ensure
35   -- consistent formatting irrespective of other umbrella parameter changes
36   -- We set the following parameters:
37   -- NLS_NUMERIC_CHARACTERS - to control how numbers are formatted (decimal
38   --                          and group separator characters)
39   -- NLS_DATE_FORMAT        - to control date format
40   -- NLS_TIMESTAMP_FORMAT, NLS_TIMESTAMP_TZ_FORMAT - to control timestamp
41   -- format
42   TYPE format_param_value IS RECORD (
43     param_num           NUMBER,
44     param_value         VARCHAR2(32767)
45   );
46 
47   TYPE format_param_values IS TABLE OF format_param_value;
48 
49   --=========================================================================--
50   --                    COMPONENT MAPPING SERVICE FUNCTIONS                  --
51   --=========================================================================--
52 
53   ------------------------------ register_component ---------------------------
54   -- NAME:
55   --     register_component
56   --
57   -- DESCRIPTION:
58   --     This procedure registers a new component with the XML reporting
59   --     framework.  It should be called at database startup from within the
60   --     dbms_report_registry package.
61   --
62   -- PARAMETERS:
63   --     component_name   (IN) - name of the component to register
64   --                             (converted to lower case)
65   --     component_desc   (IN) - description of the component to register
66   --     component_object (IN) - object to store for this component, used for
67   --                             requesting reports
68   --
69   -- RETURN:
70   --     VOID
71   -----------------------------------------------------------------------------
72   PROCEDURE register_component(
73     component_name   IN VARCHAR2,
74     component_desc   IN VARCHAR2,
75     component_object IN wri$_rept_abstract_t);
76 
77   -------------------------------- register_report ----------------------------
78   -- NAME:
79   --     register_report
80   --
81   -- DESCRIPTION:
82   --     This procedure registers a report with the framework.  One components
83   --     can have multiple reports but must have at least 1.  Having multiple
84   --     reports is the best way for components to generate XML documents that
85   --     link to each other through the <report_ref> mechanism.
86   --
87   -- PARAMETERS:
88   --     component_name (IN)   - name of the component to register
89   --     report_name    (IN)   - name of the report to register
90   --                             (converted to lower case)
91   --     report_desc    (IN)   - description of the report to register
92   --     schema_id      (IN)   - file id of schema for this report, can be NULL
93   --                             (returned from store_file)
94   --
95   -- RETURN:
96   --     VOID
97   -----------------------------------------------------------------------------
98   PROCEDURE register_report(
99     component_name   IN VARCHAR2,
100     report_name      IN VARCHAR2,
101     report_desc      IN VARCHAR2,
102     schema_id        IN NUMBER);
103 
104   ------------- build_report_reference - vararg and structure versions --------
105   -- NAME:
106   --     build_report_reference _varg/_struct - vararg and structure versions
107   --
108   -- DESCRIPTION:
109   --     This function builds a report ref string given the necessary inputs.
110   --     The report_id is given as a variable-argument list of name/value
111   --     pairs, or as an instance of the ref_string_idspec type.
112   --
113   --     For example, to generate the reference for the string
114   --     /orarep/cname/rname?foo=1AMPbar=2
115   --     (substituting AMP for the ampersand in the ref string)
116   --     call this function as
117   --
118   --     build_report_reference_varg('cname','rname','foo','1','bar','2');
119   --
120   --     or as
121   --
122   --     build_report_reference_struct('cname','rname',params) where params
123   --     has been initialized to hold 'foo' and 'bar'.
124   --
125   --     Parameter names and values are case-sensitive
126   --
127   -- NOTES:
128   --     build_report_reference_vararg cannot be called from SQL due to a known
129   --     limitation in the PL/SQL vararg implementation.  Clients can, however,
130   --     create a PL/SQL non-vararg wrapper around it and call that in SQL if
131   --     they have the need.
132   --
133   --     The framework reserves some parameter names for internal use.  See
134   --     dbms_report.get_report.
135   --
136   -- PARAMETERS:
137   --     component_name (IN)   - name of the component for ref string
138   --     report_name    (IN)   - name of the report for ref string
139   --     id_param_val   (IN)   - list of parameter names and values for
140   --                             the report_id portion of the string
141   --
142   -- RETURN:
143   --     report reference string, as VARCHAR2
144   -----------------------------------------------------------------------------
145   FUNCTION build_report_reference_varg(
146     component_name   IN VARCHAR2,
147     report_name      IN VARCHAR2,
148     id_param_val     ...)
149   RETURN VARCHAR2;
150 
151   FUNCTION build_report_reference_struct(
152     component_name   IN VARCHAR2,
153     report_name      IN VARCHAR2,
154     id_param_val     IN ref_string_idspec)
155   RETURN VARCHAR2;
156 
157   ----------------------------- parse_report_reference ------------------------
158   -- NAME:
159   --     parse_report_reference
160   --
161   -- DESCRIPTION:
162   --     This function parses a report reference to reveal its constituent
163   --     parts.  Each one is returned as an OUT parameter, converted to lower
164   --     case.  Parameter names and values are case-sensitive.
165   --
166   -- PARAMETERS:
167   --     report_reference (IN)   - report ref string to parse
168   --     component_name   (OUT)  - name of the component for ref string
169   --     report_name      (OUT)  - name of the report for ref string
170   --     id_param_val     (OUT)  - parameter names and values for ref string
171   --
172   -- RETURN:
173   --     report reference string, as VARCHAR2
174   -----------------------------------------------------------------------------
175   PROCEDURE parse_report_reference(
176     report_reference IN  VARCHAR2,
177     component_name   OUT VARCHAR2,
178     report_name      OUT VARCHAR2,
179     id_param_val     OUT ref_string_idspec);
180 
181   --------------------------------- get_param ---------------------------------
182   -- NAME:
183   --     get_param
184   --
185   -- DESCRIPTION:
186   --     Internal, get parameter from parsed report reference
187   --
188   -- PARAMETERS:
189   --     param_val     (IN)  - parameter names and value pairs for ref string
190   --     param_name    (IN)  - parameter name
191   --     mandatory     (IN)  - TRUE if parameter is mandatory. Default is FALSE
192   --     default_value (IN)  - Default value, null by default
193   --     nullable      (IN)  - TRUE if null string should be interpreted as
194   --                           a NULL value. Default is FALSE
195   --
196   -- RETURN:
197   --     parameter value, a clob. null if parameter is null or does not exists
198   -----------------------------------------------------------------------------
199   FUNCTION get_param(
200     param_val       IN ref_string_idspec,
201     param_name      IN VARCHAR2,
202     mandatory       IN BOOLEAN := FALSE,
203     default_value   IN CLOB := null,
204     nullable        IN BOOLEAN := FALSE)
205   RETURN CLOB;
206 
207   ----------------------------------- get_report ------------------------------
208   -- NAME:
209   --     get_report
210   --
211   -- DESCRIPTION:
212   --     This procedure fetches a report from its component.
213   --
214   -- PARAMETERS:
215   --     report_reference (IN) - report_ref string to use for fetching this
216   --                             report, of the form
217   --                             /orarep/component/report_name?<PARAMS>.
218   --
219   --                             Components can build a report reference by
220   --                             calling build_report_reference, or parse one
221   --                             by calling parse_report_reference.
222   --
223   --                             The following parameter names are reserved and
224   --                             interpreted by this function.  They will be
225   --                             removed from the reference string before
226   --                             dispatching the get_report call, and applied
227   --                             to the XML returned by the component.  Add
228   --                             them to your ref strings to get the related
229   --                             functionality.
230   --
231   --                               + format: maps to format name.  When
232   --                                 specified, we will apply the format before
233   --                                 returning the report
234   --                               + validate: y/n according to whether
235   --                                 framework should validate the xml report.
236   --
237   --    compress_xml      (IN) - compress xml portion of the report
238   --
239   -- RETURN:
240   --     report
241   --
242   -- NOTES:
243   --     See build_report_reference comments for sample ref strings.
244   -----------------------------------------------------------------------------
245   FUNCTION get_report(
246     report_reference IN VARCHAR2,
247     compress_xml     IN BINARY_INTEGER := 0)
248   RETURN CLOB;
249 
250 
251   ------------------------------ get_report_with_summary ----------------------
252   -- NAME:
253   --     get_report_with_summary
254   --
255   -- DESCRIPTION:
256   --     This procedure fetches a report from its component.
257   --
258   -- PARAMETERS:
259   --     report_reference (IN) - report_ref string to use for fetching this
260   --                             report, of the form
261   --                             /orarep/component/report_name?<PARAMS>.
262   --
263   --                             Components can build a report reference by
264   --                             calling build_report_reference, or parse one
265   --                             by calling parse_report_reference.
266   --
267   --                             The following parameter names are reserved and
268   --                             interpreted by this function.  They will be
269   --                             removed from the reference string before
270   --                             dispatching the get_report call, and applied
271   --                             to the XML returned by the component.  Add
272   --                             them to your ref strings to get the related
273   --                             functionality.
274   --
275   --                               + format: maps to format name.  When
276   --                                 specified, we will apply the format before
277   --                                 returning the report
278   --                               + validate: y/n according to whether
279   --                                 framework should validate the xml report.
280   --
281   -- RETURN:
282   --     report
283   --
284   -- NOTES:
285   --     See build_report_reference comments for sample ref strings.
286   -----------------------------------------------------------------------------
287   FUNCTION get_report_with_summary(report_reference IN VARCHAR2)
288   RETURN CLOB;
289 
290   --=========================================================================--
291   --                  TRANSFORMATION AND VALIDATION FUNCTIONS                --
292   --=========================================================================--
293 
294   ------------------------------ register_xslt_format -------------------------
295   -- NAME:
296   --     register_xslt_format
297   --
298   -- DESCRIPTION:
299   --     This function registers a format mapping for a report via XSLT.  Prior
300   --     to calling this function the XSLT should have been stored in XDB by
301   --     calling STORE_FILE.  After a format has been registered it can be
302   --     used by calling format_report.
303   --
304   -- PARAMETERS:
305   --     component_name      (IN) - name of component that this format
306   --                                belongs to
307   --     report_name         (IN) - name of report that this format belongs to
308   --     format_name         (IN) - format name (names are unique by report)
309   --                                  note: the name 'em' is reserved
310   --     format_desc         (IN) - format description
311   --     format_content_type (IN) - content type of format output, one of
312   --                                 + CONTENT_TYPE_TEXT: plain text
313   --                                 + CONTENT_TYPE_XML: xml
314   --                                 + CONTENT_TYPE_HTML: html
315   --                                 + CONTENT_TYPE_BINARY: other
316   --     stylesheet_id       (IN) - File ID for the XSLT
317   --                                (returned by store_file)
318   --
319   -----------------------------------------------------------------------------
320   PROCEDURE register_xslt_format(
321     component_name      IN VARCHAR2,
322     report_name         IN VARCHAR2,
326     stylesheet_id       IN NUMBER);
323     format_name         IN VARCHAR2,
324     format_desc         IN VARCHAR2,
325     format_content_type IN NUMBER := CONTENT_TYPE_HTML,
327 
328   ------------------------------ register_text_format -------------------------
329   -- NAME:
330   --     register_text_format
331   --
332   -- DESCRIPTION:
333   --     This function registers a format mapping for a text report.  Text
334   --     reports are created by first transforming an XML document to HTML
335   --     using an XSLT provided by the component, and then turning the HTML to
336   --     formatted text using the framework's own internal engine.  Prior
337   --     to calling this function the XSLT should have been stored in XDB by
338   --     calling STORE_FILE.  After a format has been registered it can be
339   --     used by calling format_report.
340   --
341   -- PARAMETERS:
342   --     component_name      (IN) - name of component for this format
343   --     report_name         (IN) - name of report for this format
344   --     format_name         (IN) - format name (names are unique by report)
345   --                                  note: the name 'em' is reserved
346   --     format_desc         (IN) - format description
347   --     html_stylesheet_id  (IN) - file id to the stylesheet that transforms
348   --                                from XML to HTML (returned by store_file)
349   --     text_max_linesize   (IN) - maximum linesize for text report
350   --
351   -----------------------------------------------------------------------------
352   PROCEDURE register_text_format(
353     component_name      IN VARCHAR2,
354     report_name         IN VARCHAR2,
355     format_name         IN VARCHAR2,
356     format_desc         IN VARCHAR2,
357     html_stylesheet_id  IN NUMBER,
358     text_max_linesize   IN NUMBER := 80);
359 
360   ----------------------------- register_custom_format ------------------------
361   -- NAME:
362   --     register_custom_format
363   --
364   -- DESCRIPTION:
365   --     This function registers a custom format for an XML document. It allows
366   --     components to format their document for viewing manually,by performing
367   --     any kind of programmatic manipulation of the XML tree and outputting
368   --     CLOB.
369   --
370   --     To apply custom formats, the framework will call the custom_format()
371   --     member function in the object type for the component.
372   --
373   -- PARAMETERS:
374   --     component_name      (IN) - name of component for this format
375   --     report_name         (IN) - name of report for this format
376   --     format_name         (IN) - format name (names are unique by report)
377   --                                  note: the name 'em' is reserved
378   --     format_desc         (IN) - format description
379   --     format_content_type (IN) - content type of format output, one of
380   --                                 + CONTENT_TYPE_TEXT: plain text
381   --                                 + CONTENT_TYPE_XML: xml
382   --                                 + CONTENT_TYPE_HTML: html
383   --                                 + CONTENT_TYPE_BINARY: other
384   --
385   -----------------------------------------------------------------------------
386   PROCEDURE register_custom_format(
387     component_name      IN VARCHAR2,
388     report_name         IN VARCHAR2,
389     format_name         IN VARCHAR2,
390     format_desc         IN VARCHAR2,
391     format_content_type IN NUMBER);
392 
393   ---------------------------------- register_swf -----------------------------
394   -- NAME:
395   --     register_swf
396   --
397   -- DESCRIPTION:
398   --     This function registers a swf file for a report.  Each report
399   --     corresponds to one swf file.  The swf file displays the report
400   --     in flash UI.
401   --
402   -- PARAMETERS:
403   --     component_name      (IN) - name of component for this swf
404   --     report_name         (IN) - name of report for this swf
405   --     swf_id              (IN) - id of the swf file
406   --
407   -----------------------------------------------------------------------------
408   PROCEDURE register_swf(
409     component_name      IN VARCHAR2,
410     report_name         IN VARCHAR2,
411     swf_id              IN NUMBER);
412 
413   --------------------------------- format_report -----------------------------
414   -- NAME:
415   --     format_report
416   --
417   -- DESCRIPTION:
418   --     This function transforms an XML document into another format, as
419   --     declared through one of the register_xxx_format calls above.
420   --
421   -- PARAMETERS:
422   --     report              (IN) - document to format
423   --     format_name         (IN) - format name to apply
424   --     compress_xml        (IN) - compress xml
425   -----------------------------------------------------------------------------
426   FUNCTION format_report(
427     report       IN XMLTYPE,
428     format_name  IN VARCHAR2,
429     compress_xml IN BINARY_INTEGER := 0)
430   RETURN CLOB;
431 
432   ------------------------------- validate_report -----------------------------
433   -- NAME:
434   --     validate_report
435   --
436   -- DESCRIPTION:
437   --     This procedure applies the XML schema registered with the framework
438   --     corresponding to the report specified to verify that it was built
439   --     correctly.
440   --
441   -- PARAMETERS:
445   --     None
442   --     report  (IN) - report to validate
443   --
444   -- RETURN:
446   --
447   -- ERRORS:
448   --     Raises error 31011 if document is not valid
449   -----------------------------------------------------------------------------
450   PROCEDURE validate_report(report IN XMLTYPE);
451 
452   ------------------------------ lookup_component_id --------------------------
453   -- NAME:
454   --     lookup_component_id
455   --
456   -- DESCRIPTION:
457   --     This function fetches a component id and returns it.  If the component
458   --     does not exist, it signals ERR_UNKNOWN_OBJECT. Note that this function
459   --     does the lookup in the view, so it can be called in an invoker rights
460   --     situation by any user.
461   --
462   -- PARAMETERS:
463   --     component_name (IN) - name of component to look up
464   --
465   -- RETURN:
466   --     component id
467   -----------------------------------------------------------------------------
468   FUNCTION lookup_component_id(component_name IN VARCHAR2)
469   RETURN NUMBER;
470 
471   ------------------------------- lookup_report_id ----------------------------
472   -- NAME:
473   --     lookup_report_id
474   --
475   -- DESCRIPTION:
476   --     This function fetches a report id and returns it.  If the report
477   --     does not exist, it signals ERR_UNKNOWN_OBJECT. Note that this function
478   --     does the lookup in the view, so it can be called in an invoker rights
479   --     situation by any user.
480   --
481   -- PARAMETERS:
482   --     component_name (IN) - name of component to look up
483   --     report_name    (IN) - name of report to look up
484   --
485   -- RETURN:
486   --     unique report id
487   -----------------------------------------------------------------------------
488   FUNCTION lookup_report_id(
489     component_name IN VARCHAR2,
490     report_name    IN VARCHAR2)
491   RETURN NUMBER;
492 
493 
494   --=========================================================================--
495   --                       UNDOCUMENTED  FUNCTIONS                           --
496   --                       ** INTERNAL USE ONLY **                           --
497   --=========================================================================--
498   PROCEDURE clear_framework(component_name IN VARCHAR2 := NULL);
499 
500   FUNCTION build_generic_tag(tag_name   IN VARCHAR2,
501                              tag_inputs ...)
502   RETURN XMLTYPE;
503 
504   FUNCTION get_report(report_reference IN  VARCHAR2,
505                       content_type     OUT NUMBER,
506                       compress_xml     IN  BINARY_INTEGER := 0)
507   RETURN CLOB;
508 
509   FUNCTION format_report(report              IN  XMLTYPE,
510                          format_name         IN  VARCHAR2,
511                          format_content_type OUT NUMBER,
512                          compress_xml        IN  BINARY_INTEGER := 0)
513   RETURN CLOB;
514 
515   FUNCTION transform_html_to_text(document     IN XMLTYPE,
516                                   max_linesize IN POSITIVE)
517   RETURN CLOB;
518 
519   -------------------------  zlib2base64_report_xml ---------------------------
520   FUNCTION zlib2base64_report_xml(report_xml IN xmltype) RETURN XMLTYPE;
521 
522   --------------------------  transform_report_xml ---------------------------
523   FUNCTION transform_report_xml(report_xml  IN xmltype,
524                                 zlib2base64 IN binary_integer := 1)
525   RETURN XMLTYPE;
526 
527   -----------------------------  gzip_report_xml ------------------------------
528   FUNCTION gzip_report_xml(report IN CLOB) RETURN BLOB;
529 
530   -------------------------------- zlib2base64_clob ---------------------------
531   FUNCTION zlib2base64_clob(report IN CLOB) RETURN CLOB;
532 
533   ------------------------------- setup_report_env ----------------------------
534   -- NAME:
535   --     setup_report_env
536   --
537   -- DESCRIPTION:
541   -- PARAMETERS:
538   --     This function sets canonical values for a few session parameters and
539   --     also returns their original values as a record type.
540   --
542   --
543   -- RETURN:
544   --     record containing original values of parameters
545   ----------------------------------------------------------------------------
546   FUNCTION setup_report_env(
547    orig_env IN OUT NOCOPY format_param_values)
548   RETURN BOOLEAN;
549 
550   ----------------------------- restore_report_env ----------------------------
551   -- NAME:
552   --     restore_report_env
553   --
554   -- DESCRIPTION:
555   --     This procedure reverts back the values of some session parameters
556   --     based on the input value.
557   --
558   -- PARAMETERS:
559   --      orig_env   (IN)   names and values of session parameters
560   --
561   -- RETURN:
562   --     void
563   -----------------------------------------------------------------------------
564   PROCEDURE restore_report_env(
565     orig_env IN format_param_values);
566 
567   ------------------------------ get_timing_info ------------------------------
568   -- NAME:
569   --     get_timing_info
570   --
571   -- DESCRIPTION:
572   --     This function allows one to get elapsed and CPU timing information
573   --     for a section of PL/SQL code
574   --
575   -- PARAMETERS:
576   --     phase          (IN)      - When called: 0 for start, 1 for end
577   --     elapsed_time  (IN/OUT)  - When "phase" is 0, OUT parameter storing
578   --                               current timestamp. When "phase" is 1, used
579   --                               both as IN/OUT to return elpased time.
580   --     cpu_time      (IN/OUT)  - When "phase" is 0, OUT parameter storing
581   --                               current cpu time. When "phase" is 1, used
582   --                               both as IN/OUT to return cpu time.
583   --
584   -- DESCRIPTION
585   --   Use this procedure to measure the elapsed/cpu time of a region of
586   --   code:
587   --     get_timing_info(0, elapsed, cpu_time);
588   --     ...
589   --     get_timing_info(1, elapsed, cpu_time);
590   --
591   -- RETURN:
592   --     None
593   --
594   ----------------------------------------------------------------------------
595   PROCEDURE get_timing_info(
596     phase      IN      BINARY_INTEGER,
597     elapsed    IN OUT  NUMBER,
598     cpu        IN OUT  NUMBER);
599 
600   ------------------------------ format_message ------------------------------
601   -- NAME:
602   --     format_message
603   --
604   -- DESCRIPTION:
605   --     This function format an Oracle message, for example an error message.
606   --
607   -- PARAMETERS:
608   --     message_number   (IN)     - message number (or error number)
609   --     message_facility (IN)     - message facility
610   --     language         (IN)     - nls language to use, null for session one
611   --     arg1             (IN)     - argument 1 if any
612   --     arg2             (IN)     - argument 2 if any
613   --     arg3             (IN)     - argument 3 if any
614   --     arg4             (IN)     - argument 4 if any
615   --     arg5             (IN)     - argument 5 if any
616   --     arg6             (IN)     - argument 6 if any
617   --     arg7             (IN)     - argument 7 if any
618   --     arg8             (IN)     - argument 8 if any
619   --     arg9             (IN)     - argument 9 if any
620   --     arg10            (IN)     - argument 10 if any
621   --     arg11            (IN)     - argument 11 if any
622   --     arg12            (IN)     - argument 12 if any
623   --
624   --
625   -- DESCRIPTION
626   --   Get the formatted message for the specified parameters
627   --
628   -- RETURN:
629   --   Formatted message
630   --
631   ----------------------------------------------------------------------------
632   FUNCTION format_message(
633     message_number        IN      PLS_INTEGER,
634     message_facility      IN      VARCHAR2 default 'ora',
635     language              IN      VARCHAR2 default NULL,
636     arg1                  IN      VARCHAR2 default NULL,
637     arg2                  IN      VARCHAR2 default NULL,
638     arg3                  IN      VARCHAR2 default NULL,
639     arg4                  IN      VARCHAR2 default NULL,
640     arg5                  IN      VARCHAR2 default NULL,
641     arg6                  IN      VARCHAR2 default NULL,
642     arg7                  IN      VARCHAR2 default NULL,
643     arg8                  IN      VARCHAR2 default NULL,
644     arg9                  IN      VARCHAR2 default NULL,
645     arg10                 IN      VARCHAR2 default NULL,
646     arg11                 IN      VARCHAR2 default NULL,
647     arg12                 IN      VARCHAR2 default NULL)
648   RETURN VARCHAR2 ;
649 
650   ----------------------- get_imported_report_attrs ---------------------
651   --  NAME: get_imported_report_attrs
652   --    This is the procedure that will return database
653   --    attributes from imported AWR data
654   --
655   -- PARAMETERS:
656   --    p_dbid           (IN)   - target database identifier
657   --    p_inst_count     (OUT)  - number of instances in RAC
658   --    p_cpu_cores      (OUT)  - number of CPU cores
659   --    p_hyperthreaded  (OUT)  - 1 if target database is hyperthreaded
660   --    p_con_id         (OUT)  - current container id if CDB
661   --    p_con_name       (OUT)  - current container name if CDB
662   --    p_is_exa         (OUT)  - 1 if target database is exadata
663   --    p_timezone_offset(OUT)  - timezone off UTC,
664   --    p_packs          (OUT)  - 2 if target database has diag+tunning
665   --                              1 if diag pack only
666   --                              0 no management packs installed
667   --
668   -----------------------------------------------------------------------
669   PROCEDURE get_imported_report_attrs (
670     p_dbid                  IN       NUMBER,
671     p_inst_count            OUT      NUMBER,
672     p_cpu_cores             OUT      NUMBER,
673     p_hyperthreaded         OUT      NUMBER,
674     p_con_id                OUT      NUMBER,
675     p_con_name              OUT      VARCHAR2,
676     p_is_exa                OUT      NUMBER,
677     p_timezone_offset       OUT      NUMBER,
678     p_packs                 OUT      NUMBER
679    );
680 
681   -- -------------------- i_get_snap_id ---------------------------------
682   -- NAME:
683   --    i_get_snap_id
684   --
685   -- DESCRIPTION
686   --    finds closest snap_id to specified time
687   --
688   -- PARAMETERS
689   --    p_time (IN) - time for which to find the closest snap_id
690   --    p_dbid (IN) - dbid to query n AWR
691   -- NOTE:
692   --
693   -- RETURNS:
694   --    snap_id
695   -- --------------------------------------------------------------------
696   FUNCTION get_snap_id(p_time IN date, p_dbid IN NUMBER)
697   RETURN NUMBER;
698 
699   -- ----------------------- get_awr_context ----------------------------
700   -- NAME:
701   --    get_awr_context
702   --
703   -- DESCRIPTION
704   --    gets up AWR begin/end snapshot for the report
705   --
706   -- PARAMETERS
707   --    p_start_time     (IN) - start time for report
708   --    p_end_time       (IN) - end time for report
709   --    p_dbid       (IN/OUT) - dbid to query. If null default
710   --                            is current dbid
711   --    p_begin_snap (IN/OUT) - sets begin snap for report
712   --    p_end_snap   (IN/OUT) - sets end snap for report
713   -- -------------------------------------------------------------------
714   PROCEDURE get_awr_context(
715     p_start_time IN     DATE,
716     p_end_time   IN     DATE,
717     p_dbid       IN OUT NUMBER,
718     p_begin_snap IN OUT NUMBER,
719     p_end_snap   IN OUT NUMBER);
720 
721 end;