A script-enabled browser is required for this page to function properly.

<function> XML tag

The <function> tag defines a PL/SQL function that you want to add to the report definition. The <function> tag must be nested within a <programUnits> tag. To reference a function, you use the formatTrigger attribute of the <field> tag.

Syntax

<function
  name="function_name">
  PLSQL_function
</function>

Parameters /Options

Description

function_name

Is the identifier for the function. This is the name that should be used when referencing the function (for example, from the formatTrigger attribute of the <field> tag).

Usage note

For reports developed in a release prior to Oracle Reports 10g Release 2 (10.1.2) patch 2, you may find the PL/SQL package specification or body is missing when opening the XML reports. In this case, either:

Example

The following example shows a segment of an XML report definition that defines some PL/SQL functions. The functions are referenced from fields in the layout through the formatTrigger attribute.

<layout>
  <section name="header"> 
    <field name="F_ssn1" 
      source="ssn1" 
      formatTrigger="F_ssn1FormatTrigger"/>
  </section>
  <section name="main">
    <field name="F_ssn" 
      source="ssn" 
      formatTrigger="F_ssnFormatTrigger"/> 
  </section>
</layout>
<programUnits> 
  <function name="F_ssn1FormatTrigger"> 
    <![CDATA[
      function F_ssn1FormatTrigger return boolean is
      begin
        SRW.SET_HYPERLINK('#EMP_DETAILS_&<' 
          || LTRIM(TO_CHAR(:SSN)) 
          || '>');
        return (TRUE);
      end;
    ]]>
  </function> 
  <function name="F_ssnFormatTrigger"> 
    <![CDATA[
      function F_ssnFormatTrigger return boolean is
      begin
        SRW.SET_LINKTAG('EMP_DETAILS_&<' 
          || LTRIM(TO_CHAR(:SSN)) 
          || '>');
        return (TRUE);
      end;
    ]]>
  </function> 
</programUnits>

See also

About XML in reports

Oracle Reports XML tags