##### Example 2: Stored procedures declared & defined in a package & package body

Suppose that the Oracle stored procedure is defined as:

    CREATE OR REPLACE PACKAGE DEMO_PKG AS
    type curtype is ref cursor;
    PROCEDURE empquery_proc(p_job in varchar2, cur OUT DEMO_PKG.curtype);
    end DEMO_PKG ;
    CREATE OR REPLACE PACKAGE BODY DEMO_PKG AS
    PROCEDURE empquery_proc(p_job in varchar2, cur OUT DEMO_PKG.curtype) AS
    lcur DEMO_PKG.curtype;
    begin
    open lcur for
    select * from EMP WHERE JOB = p_job;
    cur:=lcur;
    end empquery_proc;
    end DEMO_PKG;

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, expand the data source to which the stored procedure is to be added, then right-click the User Defined node and select Add User Defined Data Source.
3. In the Name field of the Add User 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 Parameters box, enter one of the following:
   - `DRIVER=oracle.jdbc.driver.OracleDriver&URL="jdbc:oracle:thin:@192.168.126.38:1521:oracle8"&USER=scott&PSWD=tiger
     &OWNER=SCOTT&PROCNAME=empquery_proc&SQL={call demo_pkg.empquery_proc(?,?)}&REFCURSORINDEX=2&PARAMVALUE="SALESMAN"`
   - `DRIVER=oracle.jdbc.driver.OracleDriver&URL="jdbc:oracle:thin:@192.168.126.38:1521:oracle8"&USER=scott&PSWD=tiger&
     OWNER=SCOTT&PROCNAME=empquery_proc&SQL={call demo_pkg.empquery_proc(?,?)}&REFCURSORINDEX=2&INPARAMVALUE="SALESMAN",varchar,1`
   - `OWNER=SCOTT&PROCNAME=empquery_proc&SQL={call demo_pkg.empquery_proc(?,?)}&REFCURSORINDEX=2&PARAMVALUE="SALESMAN"`
6. Click the OK button. The UDS class will then be added into the catalog.