About the Oracle Reports Builder built-in package SRW About the Tools built-in packages

Advanced Concepts 2-45 Note this example assumes you have defined a user parameter named deptno. function DS_3RefCurDS return cv.comp_cv is temp_cv cv.comp_cv; begin temp_cv := cv.emprefc:deptno; return temp_cv; end; See also Section 4.8.1.7, Creating a query: REF CURSOR Query tool

2.6.11 About DML and DDL

If you want to use Data Manipulation Language DML or Data Definition Language DDL in your PLSQL, you can use the SRW.DO_SQL built-in procedure. Note that SRW.DO_SQL should only be used for DML and DDL; you should not use it to fetch data. For more information on DML and DDL, see the Oracle Server SQL Language Reference manual. Because of Oracle Reports processing model, it is recommended that you only use DDL in the Before Parameter Form and After Parameter Form triggers. DML can be entered any place that accepts PLSQL. Any DML or DDL that will reported on with this reports processing should be done in or before the After Parameter Form trigger. Consistency cannot be guaranteed in the Before Report trigger, since Oracle Reports may have to start some work on data cursors before that trigger based on the definition of the report. One thing Oracle Reports Builder always does before the Before Report trigger is to describe the tables involved and open cursors. Any change to the tables after that will not be seen by the report. See also Section 2.6.13.1, About report triggers

2.6.12 About built-in packages

A built-in package is a group of logically related PLSQL types, objects, and functions or procedures. It generally consists of two parts: the package spec including data declarations and the package body. Packages are especially useful because they allow you to create global variables. Oracle provides several packaged procedures that you can use when building or debugging your PLSQL-based applications. Your PLSQL code can make use of the procedures, functions, and exceptions in the Oracle Reports Builder built-in package SRW, and numerous Tools built-in packages, as described below.

2.6.12.1 About the Oracle Reports Builder built-in package SRW

Oracle Reports Builder is shipped with a built-in package SRW, a collection of PLSQL constructs that include many functions, procedures, and exceptions you can reference in any of your libraries or reports. The PLSQL provided by the SRW package enables you to perform such actions as change the formatting of fields, run reports from within other reports, create 2-46 Oracle Reports Users Guide to Building Reports customized messages to display in the event of report error, and execute SQL statements. You can reference the contents of the SRW package from any of your libraries or reports without having to attach it. However, you cannot reference its contents from within another product, for example, from SQLPlus. Constructs found in a package are commonly referred to as packaged that is, packaged functions, packaged procedures, and packaged exceptions. See also Topic SRW built-in package in the Reference section of the Oracle Reports online Help

2.6.12.2 About the Tools built-in packages

Several client-side built-in packages are provided that contain many PLSQL constructs you can reference while building applications or debugging your application code. These built-in packages are not installed as extensions to the package STANDARD. As a result, any time you reference a construct in one of the packages, you must prefix it with the package name for example, TEXT_IO.PUT_LINE. The Tools built-in packages are: ■ DDE Provides Dynamic Data Exchange support within Oracle Reports Builder components. ■ DEBUG Provides procedures, functions, and exceptions for when debugging your PLSQL program units. Use these built-in subprograms to create debug triggers and set breakpoints with triggers. ■ EXEC_SQL Provides procedures and functions for executing dynamic SQL within PLSQL code written for Oracle Reports Builder applications. ■ LIST Provides procedures, functions, and exceptions you can use to create and maintain lists of character strings VARCHAR2. This provides a means of creating arrays in PLSQL Version 1. ■ ORA_FFI Provides a foreign function interface for invoking C functions in a dynamic library. ■ ORA_JAVA Provides an interface for invoking Java classes from PLSQL. ■ ORA_NLS Enables you to extract high-level information about your current language environment. This information can be used to inspect attributes of the language, enabling you to customize your applications to use local date and number format. Information about character set collation and the character set in general can also be obtained. Facilities are also provided for retrieving the name of the current language and character set, allowing you to create applications that test for and take advantage of special cases. Advanced Concepts 2-47 ■ ORA_PROF Provides procedures, functions, and exceptions you can use for tuning your PLSQL program units for example, examining how much time a specific piece of code takes to run. ■ TEXT_IO Provides constructs that allow you to read and write information from and to files. There are several procedures and functions available in Text_IO, falling into the following categories: ■ file operations . The FILE_TYPE record, the FOPEN and IS_OPEN functions, and the FCLOSE procedure enable you to define FILE_TYPE variables, open files, check for open files, and close open files, respectively. ■ output write operations . The PUT, PUTF, PUT_LINE, and NEW_LINE procedures enable you to write information to an open file or output it to the PLSQL Interpreter. ■ input read operations . The GET_LINE procedure enables you to read a line from an open file ■ TOOL_ENV Enables you to interact with Oracle environment variables by retrieving their values for use in subprograms. ■ TOOL_ERR Enables you to access and manipulate the error stack created by other built-in packages such as DEBUG. In addition to using exceptions to signal errors, some built-in packages for example, the DEBUG package provide additional error information. This information is maintained in the form of an error stack. The error stack contains detailed error codes and associated error messages. Errors on the stack are indexed from zero oldest to n-1 newest, where n is the number of errors currently on the stack. Using the services provided by the TOOL_ERR package, you can access and manipulate the error stack. ■ TOOL_RES Provides a means of extracting string resources from a resource file with the goal of making PLSQL code more portable by isolating all textual data in the resource file. The following packages are used only internally by Oracle Reports. There are no subprograms available for external use with these packages. ■ ORA_DE Contains constructs used by Reports for private PLSQL services. ■ STPROC Calls subprograms stored in the database. Calls to this package are automatically generated Note: STPROC is obsoleted in Oracle Reports 11g Release 1 11.1.1. ■ JNI Facilitates calling Java from PLSQL. 2-48 Oracle Reports Users Guide to Building Reports See also Topics for each of the Tools built-in packages under in the Reference PLSQL Reference Built-in Packages section of the Oracle Reports online Help.

2.6.13 About triggers