#### Example 3: Functions defined outside of a package

Suppose that an Oracle stored procedure is defined as:

    CREATE OR REPLACE PACKAGE SHDEMO AS
    type curtype is ref cursor;
    end SHDEMO;
    CREATE OR REPLACE FUNCTION "SCOTT"."DEPTQUERY"(p_dname in varchar2)
    return SHDEMO.curtype
    is
    lcur SHDEMO.curtype;
    begin
      open lcur for
      select * from dept where dname = p_dname;
      return lcur;
    end DEPTQUERY;

To add the stored procedure into a JReport catalog, follow the steps below:

1. Start JReport Designer and open an existing catalog.
2. In the Data tab of the Catalog Browser, right-click the data source to which the stored procedure is to be added, then select Add User Defined Data Source.
3. In the Name field of the Add User Defined Data Source dialog, specify a name for the UDS.
4. In the Class Name field, input the UDS class jet.datasource.oracle.OracleProcedureUDS.
5. In the Parameter box, enter one of the following:
   - `DRIVER=oracle.jdbc.driver.OracleDriver&URL="jdbc:oracle:thin:@<hostname>:1521:oracle8"&USER=scott&PSWD=tiger&
     OWNER=SCOTT&PROCNAME=deptquery&SQL={? = call deptquery(?)}&REFCURSORINDEX=1&PARAMVALUE=@p_dname`
   - `DRIVER=oracle.jdbc.driver.OracleDriver&URL="jdbc:oracle:thin:@<hostname>:1521:oracle8"&USER=scott&PSWD=tiger&
     OWNER=SCOTT&PROCNAME=deptquery&SQL={? = call deptquery(?)}&REFCURSORINDEX=1&INPARAMVALUE=@p_dname,varchar,1`
   - `OWNER=SCOTT&PROCNAME=deptquery&SQL={? = call deptquery(?)}&REFCURSORINDEX=1&PARAMVALUE=@p_dname`
6. Click the OK button. The UDS class will then be added into the catalog.