Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling SYS_REFCURSOR from JAVA app

Oracle_MonkeyFeb 21 2019 — edited Mar 16 2019

Hello

I ma calling the procidure liuke this

set serveroutput on

variable rc refcursor;

exec package_1.proc_1('ASIA',:rc);

print rc;

My proc_1 has something like this

if( X  IN ('AMER'  )       ) THEN

open c_ref_cur for

SELECT  * FROM DUAL;

END IF ;

c_ref_cur

Suppose if I  pass X='ASIA' which doesn't go in any IF block then   it returns  empty or null ?

When i printing RC it is showing nothing on SQL DEVELOPER console.

And i am calling the procedure from JAVA application.Its throwing me NULL POINTER EXCEPTION when the procedure is returning no rows .

StoredProcedureQuery storedProcedure = em.createStoredProcedureQuery("package_1.proc_1");

This post has been answered by Zlatko Sirotic on Feb 22 2019
Jump to Answer
Comments
Post Details
Added on Feb 21 2019
12 comments
1,759 views