About attached libraries About formulas

Advanced Concepts 2-39 See also Section 4.13.5.1, Creating an external PLSQL library

2.6.7 About attached libraries

Attached libraries are external PLSQL libraries that you have associated with a report or another external library. When an external library is attached, you can reference its packages, functions, and procedures from within your report. For example, if you attached an external library name MYLIB to your report and it contained a function named ADDXY, then you could reference ADDXY from any PLSQL in the report. External PLSQL libraries are independent of a report definition. Usage notes Local PLSQL executes more quickly than a reference to a procedure or function in an external PLSQL library. As a result, you should only use external PLSQL libraries when the benefits of sharing the code across many applications outweigh the performance overhead. Restrictions ■ If Oracle Reports Builder cannot find a library that you specify in the Attached Libraries list, a warning will be raised when you accept the dialog box, save the report, or open the report. If you try to run the report or compile the PLSQL in it, an error will be raised. ■ The Attached Libraries list is saved. The next time you open the report or library the list will have the same contents it did when you last saved the report. ■ If an external library references another library, you must attach both libraries to the report even if the first library already has the second one attached. See also Section 4.13.5.5, Attaching a PLSQL library

2.6.8 About formulas

Formulas are PLSQL functions that populate formula or placeholder columns. You can access the PLSQL for formulas from the Object Navigator, the PLSQL Editor, or the Property Inspector that is, the PLSQL Formula property. A column with Datatype property set to Number can only have a formula that returns a value of datatype NUMBER. A column with Datatype property set to Date can only have a formula that returns a value of datatype DATE. A column with Datatype property set to Character can only have a formula that returns a value of datatype CHARACTER, VARCHAR, or VARCHAR2. Restrictions ■ You can read and assign values to a column in a formula, if the column is a placeholder or parameter column; you cannot change the value of database columns values retrieved from the database. For example, you can use the value of a column called COMP in a condition for example, IF :COMP = 10 and you can directly set its value in an assignment statement for example,:COMP:= 15. ■ A formula can only make reference to columns that are in the same or a higher group in the group hierarchy. For example, a formula for a report-level column can only reference other report-level columns. 2-40 Oracle Reports Users Guide to Building Reports ■ Formulas are calculated such that any column referenced in the formula will be calculated first. To do so, Oracle Reports Builder builds a dependency list, to guarantee proper ordering of calculations. Note that circular dependencies, in which a column references another column which in turn references the first column, either directly or indirectly, are not allowed. ■ When using SRW.DO_SQL, we recommend that you do not read database values that are updated or inserted in the same report. There is no guarantee of the exact time Oracle Reports Builder will fetch records from the database for formatting the output. Oracle Reports Builder does internal data look-ahead to optimize performance. Thus, a particular record might already have been accessed before an update is issued to the same record. Oracle Reports Builder builds internal dependency lists which guarantee that events, such as invocation of user exits, calculation of summaries, and so on, happen in the correct order. However, Oracle Reports Builder cannot guarantee these events will be synchronized with its internal data access or with the formatting of data. Examples Example 1: Adding values The following example populates the column with the value of the salary plus the commission. function salcomm return NUMBER is begin return:sal + :comm; end; Example 2: Using conditions The following code adds the commission to the salary if the value for the commission is not null. function calcomm return NUMBER is temp number; begin if :comm IS NOT NULL then temp := :sal + :comm; else temp := :sal; end if; return temp; end; See also Section 2.3.2, About formula columns Section 4.13.4.3, Creating or editing a formula column Section 4.13.4.4, Creating a placeholder column

2.6.9 About group filters