How can I use a REF CURSOR returned from an Oracle Stored Procedure using the Database Toolbox (R2011a)?
Show older comments
I have an an Oracle9i database, to which I connected with a Oracle's ojdbc5.jar driver. I have also tried ojdbc6 already. The database has a stored procedure that returns a REF CURSOR. I want to call the procedure and access the contents of the REF CURSOR from MATLAB.
When I run the following commands
>> res = runstoredprocedure(conn, 'my_procedure', {} ,{oracle.jdbc.OracleTypes.CURSOR});
I get the following output in MATLAB
>> res
res =
[1x1 oracle.jdbc.driver.OracleResultSetImpl]
This shows that the result was not parsed by MATLAB.
Alternately, I try to invoke my stored procedure using EXEC and FETCH as per solution 1-49NM4L as follows
stmt = exec(dbHandle, test_ref);
where 'test_ref' is my stored procedure. This gives me the following error
'ORA-01008: not all variables bound'
The text of my stored procedure is as follows:
create or replace
PROCEDURE GETCURSOR (s_curs out types.cursorType) AS
BEGIN
open s_curs for select * from testupdate;
END GETCURSOR;
Accepted Answer
More Answers (0)
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!