Input/Output Parameters and Result Sets

Input and output parameters can be passed to stored procedures. The DB Interface Module uses RWDBColumn to describe a parameter to a stored procedure.

The RWDBStoredProc::fetchReturnParams() must be used to load the output parameters.

There is no limit on the number of input and output parameters that can be exchanged between an RWDBStoredProc and a PL/SQL procedure.

The DB Interface Module provides support for stored procedures that contain cursor variables. A cursor variable is a reference to a cursor that is defined and opened on an Oracle server. In the following sample stored procedure, written in PL/SQL, myCursor is a cursor variable.

 

create package myProcPkg as

type cursvar is ref cursor return employees%ROWTYPE;

end myProcPkg;

 

create procedure myProc(myDept in number,

myCursor in out myProcPkg.cursvar,

mySalary in number) as

begin

open myCursor for select * from employees where DEPTNO =

myDept and SALARY <= mySalary;

end myProc;

The DB Interface Module enables your application to receive an RWDBResult containing the result sets returned by the reference cursors from the execution of a stored procedure. Notice in the following code fragment that the user does not explicitly shift a cursor parameter into the procedure:

 

RWDBStoredProc myStoredProc = aDatabase.storedProc("myProc");

int myDept = 30, int mySalary = 50000;

myStoredProc["myDept"] << myDept;

myStoredProc["mySalary"] << mySalary;

RWDBResult result = myStoredProc.execute();