Error in calling Stored procedure returns REFCURSOR

Hi,
I've written a oracle stored procedure returning REFCURSOR. say,extractorderdespatchconfirmsp('','','','','','H1','ACG','','','','',:rc).
Following statement throwing error.
CallableStatement cs = con.PrepareCall("{extractorderdespatchconfirmsp('','','','','','H1','ACG','','','','',:rc)}");
rs = cs.executeQuery();
Could you rectify this problem and give me the currect code.
riyaz

Your naming convention leaves a little to be desired.
String command = "{CALL extractorderdespatchconfirmsp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
CallableStatement cstmt = conn.prepareCall(command);
//set the variables here ie, dates need to be a timestamp format. use set timestamp.
cstmt.setInt(1, 2);
cstmt.setString(2, "a string");
cstmt.setInt(3, 0);
//for return values
cstmt.registerOutParameter(3, Types.INTEGER);
cstmt.registerOutParameter(2, Types.INTEGER);
cstmt.execute();
int status = cstmt.getInt(3);
int status2 = cstmt.getInt(2);
cstmt.close();
It took me awhile too to get JDBC to call these right.

Similar Messages

  • Problem calling Stored Procedure returning SETOF UDT (Using Spring)

    I am using Spring's StoredProcedure class to call a stored procedure from a PostgreSql database. It returns a set of user defined data types. I'm having a problem in parsing the results returned.
    The user defined data type :
    CREATE TYPE process_states AS (
    process_name text,
    process_type text
    The stored procedure returns a SET of "process_state" :
    CREATE FUNTION inquire_process_state (.....)
    RETURNS SETOF process_state AS '
    SELECT ....
    I hava a Java class extending the Spring StoredProcedure classs.
    public MyProcStats extends StoredProcedure {
    private class ProcStateCallBackHandler implements RowCallBackHandler {
    public void processRow(ResultSet rs) throws SQLException {
    System.out.println(rs.getString(1));
    public MyProcStats (DataSource ds) {
    super(ds, "inquire_process_state");
    super.setFunction(true);
    declareParameter(new SqlOutparameter("rs", Types.OTHER, new ProcStateCallBackHandler());
    declareParameter(new SqlParameter("family_name", Types.VARCHAR) ;
    While testing this class, I get an errormessage
    "java.sql.SQLException:ERROR: cannot display a value of type record"
    I would appreciate if anyone can point out my mistakes. I tried declaring
    new SqlOutParameter("rs", Types.OTHER, "process_state"), but that didn't help.

    As the related posts suggest, you will need to use direct JDBC code for this.
    Also I'm not sure JDBC supports the RECORD type, so you may need to wrap your stored functions with ones that either flatten the record out, or take OBJECT types.

  • Error in calling stored procedure in sender JDBC adapter

    Hi Experts,
    I am working on MySQl to SAP scenario. I have to use stored procedure in sender JDBC adapter.
    I am calling SP as fallows: execute proc_dtdc_booking_interface_sd
    But it returned following error,
    Database-level error reported by JDBC driver while executing statement 'execute proc_dtdc_booking_interface_sd'. The JDBC driver returned the following error message: 'java.sql.SQLException: Unknown prepared statement handler (proc_dtdc_booking_interface_sd) given to EXECUTE'. For details, contact your database server vendor.
    the way i called SP is correct ??
    please suggest me how to resolve the issue ??
    Regards,
    Bhuvan.

    Hi
    Below is the code , when we are using this code directly in the mySQl command promp, it fetches 10 record but when the same code is called through XI adapter  its fetching only one record
    DELIMITER $$
    DROP PROCEDURE IF EXISTS `proc_dtdc_booking_interface_sd` $$
    CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_dtdc_booking_interface_sd`()
    BEGIN
    declare done int(1);
    declare v_dsr_booked_by char(1) ;
    declare v_dsr_branch_code char(3) ;
    declare v_dsr_cust_code varchar(7) ;
    declare v_dsr_booking_date date ;
    declare v_dsr_cnno char(9) ;
    declare v_dsr_cn_type char(3) ;
    declare v_dsr_cn_weight decimal(8,3) ;
    declare v_dsr_dest char(3) ;
    declare v_dsr_mode char(2) ;
    declare v_dsr_amt decimal(10,2) ;
    declare v_dsr_dox char(1) ;
    declare v_office_code char(3) ;
    declare v_dsr_status char(1) ;
    declare v_dsr_remarks varchar(25) ;
    declare v_dsr_refno varchar(20) ;
    declare v_dsr_transmf_no varchar(10) ;
    declare v_dsr_trans_status_xi char(1) ;
    declare v_ndsr_cnno char(9) ;
    declare v_ndsr_product char(3) ;
    declare v_ndsr_sercharge decimal(8,3) ;
    declare v_ndsr_ins_amt decimal(8,3) ;
    declare v_ndsr_others decimal(8,3) ;
    declare v_dr_amt_type decimal(2,0) ;
    declare v_dr_extra_amt decimal(10,2) ;
    declare v_sales_document varchar(2) ;
    declare bookcur CURSOR for
    SELECT *
    FROM dtdcdb_rw.dtdc_booking_interface_sd
    LIMIT 10;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET DONE=1;
    set done=0;
    OPEN bookcur;
    bookloop: loop
    FETCH bookcur
    INTO
    v_dsr_booked_by ,
    v_dsr_branch_code,
    v_dsr_cust_code,
    v_dsr_booking_date,
    v_dsr_cnno,
    v_dsr_cn_type,
    v_dsr_cn_weight,
    v_dsr_dest,
    v_dsr_mode,
    v_dsr_amt,
    v_dsr_dox,
    v_office_code,
    v_dsr_status,
    v_dsr_remarks,
    v_dsr_refno,
    v_dsr_transmf_no,
    v_dsr_trans_status_xi,
    v_ndsr_cnno,
    v_ndsr_product,
    v_ndsr_sercharge,
    v_ndsr_ins_amt,
    v_ndsr_others,
    v_dr_amt_type,
    v_dr_extra_amt,
    v_sales_document ;
    IF DONE=1 THEN
    LEAVE bookloop;
    END IF;
    select
    v_dsr_booked_by As dsr_booked_by,
    v_dsr_branch_code As dsr_branch_code,
    v_dsr_cust_code As dsr_cust_code,
    v_dsr_booking_date As dsr_booking_date,
    v_dsr_cnno As dsr_cnno,
    v_dsr_cn_type As dsr_cn_type,
    v_dsr_cn_weight As dsr_cn_weight,
    v_dsr_dest As dsr_dest,
    v_dsr_mode As dsr_mode,
    v_dsr_amt As dsr_amt,
    v_dsr_dox As dsr_dox,
    v_office_code As office_code,
    v_dsr_status As dsr_status,
    v_dsr_remarks As dsr_remarks,
    v_dsr_refno As dsr_refno,
    v_dsr_transmf_no As dsr_transmf_no,
    v_dsr_trans_status_xi As dsr_trans_status_xi,
    v_ndsr_cnno As ndsr_cnno,
    v_ndsr_product As ndsr_product,
    v_ndsr_sercharge As ndsr_sercharge,
    v_ndsr_ins_amt As ndsr_ins_amt,
    v_ndsr_others As ndsr_others,
    v_dr_amt_type As dr_amt_type,
    v_dr_extra_amt As dr_extra_amt,
    v_sales_document As sales_document;
    update dtdcdb_rw.dsr_table
    set dsr_trans_status_xi='T'
    where dsr_cnno=v_dsr_cnno;
    end loop;
    SELECT *
    FROM dtdcdb_rw.dtdc_booking_interface_sd
    LIMIT 10;
    END $$
    DELIMITER ;
    Please help
    Regards
    Bhuvan

  • JCA Error while calling Stored Procedure containing cursors in BPEL/OSB

    Hi,
    I created JCA DBAdapter in Jdeveloper for calling remote stored procedure which contains cursors as OUT parameters.
    I'm getting below exception when i try to call the database via BPEL/OSB.the same remote procedure call is working on Invoking with WLI .
    Kindly sugggest !!!
    The invocation resulted in an error: I*nvoke JCA outbound service failed with connection error, exception: com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/ServiceBus/BusinessServices/IsdnSiebelConn [ IsdnSiebelConn_ptt::IsdnSiebelConn(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'IsdnSiebelConn' failed due to: Get object error.*
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    *; nested exception is:*
    BINDING.JCA-11810
    Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    Check to ensure that the parameter has been correctly registered as a valid IN/OUT or OUT parameter of the API. This exception is considered retriable, likely due to a communication failure. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers.
    com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/ServiceBus/BusinessServices/IsdnSiebelConn [ IsdnSiebelConn_ptt::IsdnSiebelConn(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'IsdnSiebelConn' failed due to: Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    ; nested exception is:
    BINDING.JCA-11810
    Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    Check to ensure that the parameter has been correctly registered as a valid IN/OUT or OUT parameter of the API. This exception is considered retriable, likely due to a communication failure. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers.
    at com.bea.wli.sb.transports.jca.binding.JCATransportOutboundOperationBindingServiceImpl.invoke(JCATransportOutboundOperationBindingServiceImpl.java:153)
    at com.bea.wli.sb.transports.jca.JCATransportEndpoint.sendRequestResponse(JCATransportEndpoint.java:209)
    at com.bea.wli.sb.transports.jca.JCATransportEndpoint.send(JCATransportEndpoint.java:170)
    at com.bea.wli.sb.transports.jca.JCATransportProvider.sendMessageAsync(JCATransportProvider.java:571)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.wli.sb.transports.Util$1.invoke(Util.java:83)
    at $Proxy127.sendMessageAsync(Unknown Source)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageAsync(LoadBalanceFailoverListener.java:148)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToServiceAsync(LoadBalanceFailoverListener.java:603)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToService(LoadBalanceFailoverListener.java:538)
    at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageToService(TransportManagerImpl.java:558)
    at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageAsync(TransportManagerImpl.java:426)
    at com.bea.wli.sb.test.service.ServiceMessageSender.send0(ServiceMessageSender.java:377)
    at com.bea.wli.sb.test.service.ServiceMessageSender.access$000(ServiceMessageSender.java:76)
    at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:134)
    at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:132)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
    at com.bea.wli.sb.test.service.ServiceMessageSender.send(ServiceMessageSender.java:137)
    at com.bea.wli.sb.test.service.ServiceProcessor.invoke(ServiceProcessor.java:454)
    at com.bea.wli.sb.test.TestServiceImpl.invoke(TestServiceImpl.java:172)
    at com.bea.wli.sb.test.client.ejb.TestServiceEJBBean.invoke(TestServiceEJBBean.java:167)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.invoke(TestService_sqr59p_EOImpl.java:353)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_1033_WLStub.invoke(Unknown Source)
    at com.bea.alsb.console.test.TestServiceClient.invoke(TestServiceClient.java:174)
    at com.bea.alsb.console.test.actions.DefaultRequestAction.invoke(DefaultRequestAction.java:117)
    at com.bea.alsb.console.test.actions.DefaultRequestAction.execute(DefaultRequestAction.java:70)
    at com.bea.alsb.console.test.actions.ServiceRequestAction.execute(ServiceRequestAction.java:143)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
    at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.processActionPerform(SBConsoleRequestProcessor.java:91)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
    at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.process(SBConsoleRequestProcessor.java:191)
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
    at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:256)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:133)
    at com.bea.alsb.console.common.base.SBConsoleActionServlet.doGet(SBConsoleActionServlet.java:49)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:687)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
    at com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.processAction(StrutsStubImpl.java:76)
    at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
    at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
    at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
    at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
    at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
    at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
    at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
    at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
    at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    You need to open all the cursors in the PLSQL ie., cursors should be initialized in your PLSQL package. JCA DB Adapter tries to open the cursor without checking whether its there or not..If you cant change the PLSQL package, raise a SR with Oracle for a patch.This would be considered as Enhancement Request.
    Regards
    Sesha

  • Error while calling stored procedure from apps adapter

    Hi,
    I am calling Oracle applications standard api to create ar invoice (XX_BPEL_TEST_APPS_ADAPTER_PKG is the name of wrapper package created by adapter) from apps adapter but getting the following error:
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'test_apps_adapter' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG.AR_INVOICE_API_PUB$CREATE_SIN API. An error occurred while preparing and executing the APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG.AR_INVOICE_API_PUB$CREATE_SIN API. Cause: java.sql.SQLException: ORA-06531: Reference to uninitialized collection ORA-06512: at "APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG", line 199 ORA-06512: at "APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG", line 909 ORA-06512: at line 1 Check to ensure that the API is defined in the database and that the parameters match the signature of the API. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value "-6531" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    Just wondering if anyone has faced a similar problem?

    I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 12
    Here is example for my test procedure:
    declare
    v_session_id_tab SESSION_ID_TAB_TYPE;
    v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
    v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
    v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
    v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
    v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
    v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
    v_status_tab STATUS_TAB_TYPE;
    v_notes_tab NOTES_TAB_TYPE;
    begin
    v_session_id_tab(1) := 1;
    v_service_type_tab(1) := 'db';
    v_service_location_tab(1) := 'local';
    v_service_call_name_tab(1) := 'Name of call';
    v_service_call_start_time_tab(1) := SYSDATE;
    v_service_call_end_time_tab(1) := SYSDATE;
    v_service_call_duration_tab(1) := 100;
    v_status_tab(1) := 'Z';
    v_notes_tab(1) := 'NOTES';
    BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
    v_service_call_duration_tab, v_status_tab, v_notes_tab);
    end;
    I declare all types at schema level.
    Please give your comments.
    Thank you

  • Error while calling stored procedure from Java

    Hi Guys,
    How are you everybody? I hope everything is goin fine on your side. I have one issue in PL/SQL while calling below stored procedures from Java.
    Problem Description: We have a stored procedure PROCEDURE BULK_INSERTS (
    V_SESSION_ID_TAB IN T_SESSION_ID_TAB_TYPE,
    V_SERVICE_TYPE_TAB IN T_SERVICE_TYPE_TAB_TYPE,
    V_SERVICE_LOCATION_TAB IN T_SERVICE_LOCATION_TAB_TYPE,
    V_SERVICE_CALL_NAME_TAB IN T_SERVICE_CALL_NAME_TAB_TYPE,
    V_SERVICE_CALL_START_TIME_TAB IN T_SERVICE_CALL_ST_TAB_TYPE,
    V_SERVICE_CALL_END_TIME_TAB IN T_SERVICE_CALL_ET_TAB_TYPE,
    V_SERVICE_CALL_DURATION_TAB IN T_SERVICE_CALL_DUR_TAB_TYPE,
    V_STATUS_TAB IN T_STATUS_TAB_TYPE,
    V_NOTES_TAB IN T_NOTES_TAB_TYPE
    ) and we are getting ora errors while calling this stored procedure from java.
    All tab types are declared locally, at package level.
    Here is error which occur while calling this sp:
    {call BULK_PKG.BULK_INSERTS(?,?,?,?,?,?,?,?,?)}
    And the parameter types we are using are:
    SESSION_ID - NUM_TAB_TYPE
    SERVICE_TYPE - VAR_TAB_TYPE
    SERVICE_LOCATION - VAR_TAB_TYPE
    SERVICE_CALL_NAME - VAR_TAB_TYPE
    SERVICE_CALL_START_TIME - DATE_TIME_TAB_TYPE
    SERVICE_CALL_END_TIME - DATE_TIME_TAB_TYPE
    SERVICE_CALL_DURATION - NUM_TAB_TYPE
    STATUS - VAR_TAB_TYPE
    NOTES - VAR_TAB_TYPE
    And the Exception stack trace is:
    ERROR (com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServi
    ceCallDAO.java:143)@ExecuteThread: '252' for queue: 'weblogic.kernel.Default') {Error attempting to save collected ESC data}
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:944)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3482)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3856)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1373)
    at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:98)
    at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.doBulkInsert(ExternalServiceCallDAO.java:220)
    at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServiceCallDAO.java:138)
    Please help my guys out of this. I will really appreciate all suggestions and advices.
    Thank you everybody.

    I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 12
    Here is example for my test procedure:
    declare
    v_session_id_tab SESSION_ID_TAB_TYPE;
    v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
    v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
    v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
    v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
    v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
    v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
    v_status_tab STATUS_TAB_TYPE;
    v_notes_tab NOTES_TAB_TYPE;
    begin
    v_session_id_tab(1) := 1;
    v_service_type_tab(1) := 'db';
    v_service_location_tab(1) := 'local';
    v_service_call_name_tab(1) := 'Name of call';
    v_service_call_start_time_tab(1) := SYSDATE;
    v_service_call_end_time_tab(1) := SYSDATE;
    v_service_call_duration_tab(1) := 100;
    v_status_tab(1) := 'Z';
    v_notes_tab(1) := 'NOTES';
    BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
    v_service_call_duration_tab, v_status_tab, v_notes_tab);
    end;
    I declare all types at schema level.
    Please give your comments.
    Thank you

  • Facing syntax error while calling stored procedure

    hi
    iam calling a stored procedure which is a sybase USP.my code is as follows
    clsm3=CommonLib.cnClient.prepareCall("{call SYB1103.SIFGSYS..USP_Ins_ShipmentInvLines_Tmp "+coid+",'"+invclass+"',"+newsysno+","+productcd+",'"+batchno+"',"+qty+","+productrate+","+assrate+","+expercent+","+examt+","+saleed+","+bonused+",'"+recby+"',"+linestat+","+brno+","+prinvno+","+invno+","+recno+"}");
    clsm3.executeUpdate();
    where clsm3 is an object of CallableStatement.but it is giving me a syntax error saying
    "Invalid JDBC escape syntax at line position 84 '}' character expected"
    please reply as soon as possible

    clsm3=CommonLib.cnClient.prepareCall("{call
    {call SYB1103.SIFGSYS..USP_Ins_ShipmentInvLines_Tmp
    "+coid+",'"+invclass+"',"+newsysno+","+productcd+",'"+
    batchno+"',"+qty+","+productrate+","+assrate+","+exper
    cent+","+examt+","+saleed+","+bonused+",'"+recby+"',"+
    linestat+","+brno+","+prinvno+","+invno+","+recno+"}")
    ;clsm3=CommonLib.cnClient.prepareCall("call <PROCEDURE_NAME>(?,?,?,....)
    clsm3.setString(1,coid);
    clsm3.setInt(2,invclass);
    and so on...
    Try the above. The syntax of the call is wrong in your code.

  • Getting error when calling stored procedure

    I have created 2 stored procedures as follows
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go
    ALTER PROCEDURE [dbo].[REAL_PUSH_UPDATE_REPORTS] AS
    BEGIN TRANSACTION
         DECLARE @cursor_contact_id bigint;
         DECLARE cursorContactId Cursor FOR SELECT distinct(contact_id) FROM [dbo].credit_reports WHERE loan_id IS NULL;
         OPEN cursorContactId;
         Fetch NEXT FROM cursorContactId INTO @cursor_contact_id;
    IF(@@FETCH_STATUS <> 0)
    PRINT 'There are no LOAN contacts are there with loan ID null, May be you have already executed this procedure'
         WHILE(@@FETCH_STATUS =0)
         BEGIN
    PRINT @cursor_contact_id;
              EXECUTE REAL_UPDATE_REPORTS @cursor_contact_id;
              Fetch NEXT FROM cursorContactId INTO @cursor_contact_id
         END
         CLOSE cursorContactId;
         DEALLOCATE cursorContactId;
         IF (@@Error = 0)
              BEGIN
                   COMMIT TRANSACTION;
              END
         ELSE
              BEGIN
                   ROLLBACK TRANSACTION;
              END
    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go
    ALTER PROCEDURE [dbo].[REAL_UPDATE_REPORTS] @initial_contact_id bigint AS
    BEGIN TRANSACTION
         DECLARE @loan_count bigint;
         DECLARE cursorLoanID Cursor FOR (SELECT l.loan_id loanIDList FROM (([dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
    ON lr.loan_id=l.loan_id
    AND lr.contact_id = l.primary_borrower_id)
    LEFT OUTER JOIN [dbo].loan_codes lc
    ON l.loan_code_id = lc.loan_code_id) 
    WHERE (l.primary_borrower_id=@initial_contact_id)
    AND l.active=1  UNION  SELECT l.loan_id 
    FROM   [dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
    ON lr.loan_id=l.loan_id LEFT OUTER JOIN [dbo].contacts c
    ON c.contact_id =l.primary_borrower_id
    WHERE (l.loan_id IN
    (SELECT cb.loan_id FROM coborrowers cb where contact_id =@initial_contact_id and active = 1))
    UNION
    SELECT l.loan_id 
    FROM   [dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
    ON lr.loan_id=l.loan_id LEFT OUTER JOIN [dbo].contacts c
    ON c.contact_id =l.primary_borrower_id
    WHERE (l.loan_id IN (SELECT cs.loan_id
    FROM cosigners   cs where contact_id =@initial_contact_id and active = 1)) UNION
    SELECT g.loan_id  FROM   [dbo].groups g, [dbo].group_members gm,
    [dbo].loan_requests lr WHERE gm.group_id = g.group_id
    AND lr.loan_id = g.loan_id
    AND lr.contact_id = gm.secondary_borrower_id
    AND gm.secondary_borrower_id=@initial_contact_id and gm.active = 1) 
    ORDER BY loanIDList DESC;
         OPEN cursorLoanID;
         SET @loan_count = @@CURSOR_ROWS;
    PRINT @loan_count;
         IF(@loan_count > 0)     BEGIN
              DECLARE @loans_loan_id bigint;
              Fetch NEXT FROM cursorLoanID INTO @loans_loan_id;
              DECLARE @my_count bigint;
              SET @my_count=1;
              WHILE(@@FETCH_STATUS =0)
              BEGIN
                   DECLARE @temp_contact_id bigint;
                   DECLARE @temp_loan_id bigint;
                   SET @temp_contact_id = @initial_contact_id;
                   SET @temp_loan_id = @loans_loan_id;
                   IF(@my_count=@loan_count)
                        BEGIN
                             UPDATE [dbo].credit_reports SET loan_id = @temp_loan_id WHERE
    loan_id IS NULL AND contact_id = @initial_contact_id 
    AND NOT EXISTS (SELECT * FROM  [dbo].credit_reports
    WHERE contact_id = @initial_contact_id  AND
    loan_id=@temp_loan_id);
                        END
                   ELSE
                        BEGIN
                             INSERT INTO [dbo].credit_reports(contact_id,credit_bureau_id, credit_score, thirty_days_late,
    sixty_days_late, ninety_days_late, currently_negative, amount_past_due,
    inquiries_six_mos, public_records, collections, total_accounts_balance,
    total_mthly_pymts, report_file, report_gu_id, data_entry_by, data_entry_date,
    loan_id)  SELECT contact_id,credit_bureau_id, credit_score, thirty_days_late,
    sixty_days_late, ninety_days_late, currently_negative, amount_past_due,
    inquiries_six_mos, public_records, collections, total_accounts_balance,
    total_mthly_pymts, report_file, report_gu_id, data_entry_by,
    data_entry_date,@temp_loan_id   FROM [dbo].credit_reports WHERE contact_id
    = @initial_contact_id AND loan_id IS NULL
    AND NOT EXISTS (SELECT * FROM
    [dbo].credit_reports WHERE contact_id=@initial_contact_id AND
    loan_id=@temp_loan_id);
    END
    Fetch NEXT FROM cursorLoanID INTO @loans_loan_id;               
    SET @my_count = @my_count + 1;
              END
    close cursorLoanID
    deallocate cursorLoanID
              IF (@@Error = 0)
                   BEGIN
                        COMMIT TRANSACTION;
                        PRINT 'Success for contactID :'+CONVERT(varchar(50),@initial_contact_id);
                   END
              ELSE
                   BEGIN
                        ROLLBACK TRANSACTION;
                        PRINT 'Failed for contactID :'+CONVERT(varchar(50),@initial_contact_id);
                   END
         END
         ELSE
         BEGIN
              ROLLBACK;
              PRINT 'NO Loans For the contactID :'+CONVERT(varchar(50),@initial_contact_id);
         ENDnow the problem is
    i have executed 2 procedures saperately thn its ok while im calling im getting
    Msg 16915, Level 16, State 1, Procedure REAL_UPDATE_REPORTS, Line 5
    A cursor with the name 'cursorLoanID' already exists.
    Msg 16905, Level 16, State 1, Procedure REAL_UPDATE_REPORTS, Line 6
    The cursor is already open.Please let me know the reason...
    Thank you.
    Message was edited by:
    User71408

    What the heck, that's fun..
    I for one, have never seen T-sql or whatever it's called.
    Looking at it, it seems that a
    close cursorLoanID
    deallocate cursorLoanID
    is missing from the ELSE section doing the rollback.
    But, only guessing
    Fun, fun, fun

  • Error in calling stored procedure

    PROBLEM RESOLVED !!! PLEASE IGNORE
    THANKS
    Hi i am a newbie. I am trying to call a stored procedure but landed up with error.
    calling like :
    CallableStatement callStmt = objDBHandler1.getCallableStatement("{call PKG.calc_sa_premium(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
    Error :
    00:34:33,031 INFO [STDOUT] before prepare call callable stmt is =========>{call PKG.calc_sa_premium(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    00:34:33,031 ERROR [STDERR] java.lang.NullPointerException
    00:34:33,031 ERROR [STDERR]      at com.db.DBHandler1.getCallableStatement(DBHandler1.java:199)
    00:34:33,031 ERROR [STDERR]      at com.team.bi.calculator.execute(calculator.java:168)
    00:34:33,031 ERROR [STDERR]      at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
    00:34:33,031 ERROR [STDERR]      at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
    00:34:33,031 ERROR [STDERR]      at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
    00:34:33,031 ERROR [STDERR]      at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    00:34:33,031 ERROR [STDERR]      at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    00:34:33,031 ERROR [STDERR]      at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    00:34:33,031 ERROR [STDERR]      at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    00:34:33,031 ERROR [STDERR]      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    00:34:33,031 ERROR [STDERR]      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
    00:34:33,031 ERROR [STDERR]      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    00:34:33,031 ERROR [STDERR]      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    00:34:33,031 ERROR [STDERR]      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    00:34:33,031 ERROR [STDERR]      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    00:34:33,031 ERROR [STDERR]      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    00:34:33,031 ERROR [STDERR]      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    00:34:33,031 ERROR [STDERR]      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    00:34:33,031 ERROR [STDERR]      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    00:34:33,031 ERROR [STDERR]      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    00:34:33,031 ERROR [STDERR]      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    00:34:33,031 ERROR [STDERR]      at java.lang.Thread.run(Unknown Source)
    00:34:33,031 INFO [STDOUT] Error in calling Procedure while getting Total Premium:java.lang.NullPointerException
    Please let me know if you have any clue.
    Thanks
    Edited by: newbie123 on Nov 29, 2009 1:59 PM
    Edited by: newbie123 on Nov 29, 2009 1:59 PM

    yes,
    here is the code
    callStmt.setString(1,aa);
    callStmt.setString(2,bb);
    callStmt.setString(3,cc);
    callStmt.setInt(4,dd);
    callStmt.setInt(5,ee);
    callStmt.setString(6,ff);
    callStmt.setString(7,gg);
    callStmt.setString(8,hh);
    callStmt.setDouble(9,ii);
    callStmt.setString(10,jj);
    callStmt.setString(11,kk);
    callStmt.setInt(12,ll);
    callStmt.setString(13,mm);
    callStmt.setInt(14,nn);
    callStmt.setString(15,oo);
    callStmt.setString(16,pp);
    /* callStmt.registerOutParameter(17, OracleTypes.CURSOR);
    callStmt.registerOutParameter(18, OracleTypes.CURSOR);
    callStmt.registerOutParameter(19, OracleTypes.CURSOR);
    callStmt.registerOutParameter(20, OracleTypes.CURSOR);
    callStmt.registerOutParameter(21, OracleTypes.CURSOR);
    callStmt.registerOutParameter(22, OracleTypes.CURSOR);*/
    callStmt.registerOutParameter(17,OracleTypes.NUMERIC);//prem
    callStmt.registerOutParameter(18,OracleTypes.NUMERIC);//st
    callStmt.registerOutParameter(19,OracleTypes.NUMERIC);//tp
    callStmt.registerOutParameter(20,OracleTypes.NUMERIC);//sa
    callStmt.registerOutParameter(21,OracleTypes.VARCHAR);//text
    callStmt.registerOutParameter(22,OracleTypes.VARCHAR);//text1

  • Calling stored procedure returning result set

    Hi all,
    i know this issue is discussed quite often. I did not find an answer in the forums, not in the manual and even not in the examples for stored procedure.
    So i try it here once more :)
    Description:
    GET_SKS:
    The GET_SKS procedure is used to generate a number of surrogate keys. It has one input parameter NUM_SKS_IN that specifies the number of keys to generate. The generated keys are returned as a result set.
    So i tried:
    CallableStatemant sproc_stmt = lsession.connection().prepareCall("{ call Get_SKS(?,?)}");
    sproc_stmt.setInt(2,1);
    sproc_stmt.registerOutParameter(1,OracleTypes.CURSOR);
    sproc_stmt.execute();
    ResultSet sproc_result = (ResultSet) sproc_stmt.getObject(1);
    I got the exception:
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GET_SKS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Thanks for help! This is really getting frustrating...
    Regards,
    ak

    Hi there,
    i could speak to our one of our admins. This is what he gave me:
    CREATE OR REPLACE PROCEDURE "TCSDBOWNER"."GET_SKS"
       (num_sks_in IN INTEGER,
        sk_out OUT SYS_INFO.SYS_INFO_SK%TYPE)
    AS
    /*+
    || Procedure - GET_SKS - Oracle
    ||
    || Description:
    ||   This procedure is used to get one or more primary keys for tables with
    ||   surrogate keys as the primary key.  This number is unique across all
    ||   tables and installations for a given client.
    ||
    || Parameters:
    ||   num_sks_in - INTEGER: number of surrogate keys to return
    ||   sk_out - sk_subtype: first key in the sequence of requested keys
    ||
    || History:
    ||   08/30/01,dcs: Created
      CURSOR request_cur IS
        select DBMS_LOCK.REQUEST(170333184) from dual;
      CURSOR release_cur IS
        select DBMS_LOCK.RELEASE(170333184) from dual;
      CURSOR dual_sk_cur IS
         select SEQ_SK.NEXTVAL SK
           from DUAL;
      v_base_offset SYS_INFO.BASE_OFFSET%TYPE;
      v_sk SYS_INFO.SYS_INFO_SK%TYPE;
      v_sqlstring VARCHAR2(1000);
      v_cursor_handle INTEGER;
      v_return INTEGER;
    BEGIN
      IF num_sks_in < 1 THEN
        TCS_EXC.RAISE_ERROR(TCS_EXC.num_sks_in_lt_1);
      END IF;
      OPEN request_cur;
      FETCH request_cur INTO v_return;
      CLOSE request_cur;
      IF v_return <> 0 AND v_return <> 4 THEN
        TCS_EXC.RAISE_ERROR(TCS_EXC.sk_gen_lock_failed);
      END IF;
      v_cursor_handle := DBMS_SQL.OPEN_CURSOR;
      v_sqlstring := 'ALTER SEQUENCE SEQ_SK INCREMENT BY '|| TO_CHAR(num_sks_in);
      DBMS_SQL.PARSE(v_cursor_handle, v_sqlstring, DBMS_SQL.V7);
      v_return := DBMS_SQL.EXECUTE(v_cursor_handle);
      DBMS_SQL.CLOSE_CURSOR(v_cursor_handle);
      GET_BASE_OFFSET(v_base_offset);
      OPEN dual_sk_cur;
      FETCH dual_sk_cur INTO v_sk;
      CLOSE dual_sk_cur;
      sk_out := (v_base_offset * 10000000000) + v_sk - num_sks_in + 1;
      v_cursor_handle := DBMS_SQL.OPEN_CURSOR;
      v_sqlstring := 'ALTER SEQUENCE SEQ_SK INCREMENT BY 1';
      DBMS_SQL.PARSE(v_cursor_handle, v_sqlstring, DBMS_SQL.V7);
      v_return := DBMS_SQL.EXECUTE(v_cursor_handle);
      DBMS_SQL.CLOSE_CURSOR(v_cursor_handle);
      OPEN release_cur;
      FETCH release_cur INTO v_return;
      CLOSE release_cur;
      IF v_return <> 0 THEN
        TCS_EXC.RAISE_ERROR(TCS_EXC.sk_gen_lock_failed);
      END IF;
    END GET_SKS; Ok, i tried with that but even not succeded yet. Can anybody help me to code that into a java call?
    Regards,
    ak

  • Error While calling stored procedure with array

    I am getting following error
    java.sql.SQLException: Fail to construct descriptor: Invalid arguments
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:829)
    at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:85)
    at oracle.sql.STRUCT.toSTRUCT(STRUCT.java:322)
    at oracle.jdbc.oracore.OracleTypeADT.toDatum(OracleTypeADT.java:253)
    at oracle.jdbc.oracore.OracleTypeADT.toDatumArray(OracleTypeADT.java:296)
    at oracle.jdbc.oracore.OracleTypeUPT.toDatumArray(OracleTypeUPT.java:137)
    at oracle.sql.ArrayDescriptor.toOracleArray(ArrayDescriptor.java:750)
    while executing following code
    com.brocade.wwn.params.AuthParams ap = new com.brocade.wwn.params.AuthParams();
    ap.setAuthKey("1");
    ap.setAuthValue("1.1");
    com.brocade.wwn.params.AuthParams ap1 = new com.brocade.wwn.params.AuthParams();
    ap.setAuthKey("11");
    ap.setAuthValue("1.11");
    //com.brocade.wwn.params.AuthParams[] arrAP = new com.brocade.wwn.params.AuthParams[1];
    //Object[] arrAP = new Object[1];
    //arrAP[0] = ap;
    com.brocade.wwn.params.AuthParams[] arrAP = {ap,ap1};
    System.out.println(" >>> Creating Array Descriptor .... ");
    oracle.sql.ArrayDescriptor arraydesc =
    oracle.sql.ArrayDescriptor.createDescriptor("WWP.AUTH_ENTRIES", conn);
    System.out.println (" ----> " + arraydesc.getBaseName());
    System.out.println (" ----> " + arraydesc.getName());
    System.out.println (" ----> " + arraydesc.getSQLName());
    System.out.println (" ----> " + arraydesc.getSchemaName());
    System.out.println (" ----> " + arraydesc.getTypeName());
    System.out.println (" ----> " + arraydesc.getMaxLength());
    System.out.println (" ----> " + arraydesc.getArrayType());
    System.out.println ( arraydesc.TYPE_VARRAY + " : " + arraydesc.TYPE_NESTED_TABLE );
    // Object[] tObj = arraydesc.toArray(arrAP);
    //tObj = new String[2];
    //tObj[0] = "sdaf";
    //tObj[1] = "sdaf1";
    // tObj[0] = ap;
    System.out.println(" >>> Array Descriptor Created .... ");
    oracle.sql.ARRAY array = new oracle.sql.ARRAY(arraydesc, conn, arrAP);
    My database is Oracle 8i and I am using oracle 9i thin drivers.
    Can anybody help me on this ....
    thanks

    I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 12
    Here is example for my test procedure:
    declare
    v_session_id_tab SESSION_ID_TAB_TYPE;
    v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
    v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
    v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
    v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
    v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
    v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
    v_status_tab STATUS_TAB_TYPE;
    v_notes_tab NOTES_TAB_TYPE;
    begin
    v_session_id_tab(1) := 1;
    v_service_type_tab(1) := 'db';
    v_service_location_tab(1) := 'local';
    v_service_call_name_tab(1) := 'Name of call';
    v_service_call_start_time_tab(1) := SYSDATE;
    v_service_call_end_time_tab(1) := SYSDATE;
    v_service_call_duration_tab(1) := 100;
    v_status_tab(1) := 'Z';
    v_notes_tab(1) := 'NOTES';
    BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
    v_service_call_duration_tab, v_status_tab, v_notes_tab);
    end;
    I declare all types at schema level.
    Please give your comments.
    Thank you

  • Error when calling Stored Procedure from backing bean

    I am using Jdeveloper 11.1.1.6 and am trying to utilize the following URL to execute a SP from a backing bean: http://ramannanda.blogspot.com/2011/11/optimized-update-insert-adf.html
    The reason I am looking at this is currently I have coded my backing bean to perform inserts and deletes through the use of my View Objects. I am performing up to a combined 5-10K inserts and deletes and the performance is rather slow. If there is a way to tune the view objects as well as the commit to be much faster, that is the prefered method. If that can't be done then I would like to figure out the approach identified in the URL.
    I have highlighted a section of code below that is failing when using the URL approach. It errors out with the following exception: javax.el.ELException: oracle.jbo.JboException: java.sql.SQLException: Internal Error: Inconsistent catalog view
    Do you have thoughts as to what might cause this exception.
    create or replace
    type TYP_TEST_R is object
         Test_Id Number(5,0) ,
         Test_Num Number(7,0)
    create or replace
    type TYP_TEST_TB as table of TYP_TEST_R;
    private void myMethod(MyTableVORowImpl pCurrentRow) {
    int i = 0;
    DCIteratorBinding lDciter =
    (DCIteratorBinding)getBindings().get("MyTable1Iterator");
    MyAppModuleAMImpl lMyAppModuleAMImpl =
    (MyAppModuleAMImpl)lDciter.getViewObject().getApplicationModule();
    Connection lConnection =
    lMyAppModuleAMImpl.getDBTransaction().createStatement(1).getConnection();
    StructDescriptor lTblRecordStructType =
    StructDescriptor.createDescriptor("DBADMIN.TYP_TEST_R",
    lConnection);
    .....<additional logic here>......
    Object lArray[] = new Object[lSortedDifferences.size()];
    while (........) {
    Number lNumber = .......
    Number lDifferentStore = (Number)lDifferentIterator.next();
    STRUCT lTempStruct =+_
    new STRUCT(lTblRecordStructType, lConnection,+_
    *new Object[] { pCurrentRow.getTestId(),*+_
    lDifferentStore });+_
    lArray[i] = lTempStruct;
    i = i + 1;
    //create array structure descriptor
    ArrayDescriptor lTableDesc =
    ArrayDescriptor.createDescriptor("DBADMIN.TYP_TEST_TB",
    lConnection);
    //create an Array type with given structure definition
    ARRAY lTableArray =
    new ARRAY(lTableDesc, lConnection, lArray);
    String lCallableProcedureStatement =
    " begin DBADMIN.SP_TEST(?,?); end;";
    OracleCallableStatement lOracleCallableStatement = null;
    lOracleCallableStatement =
    (OracleCallableStatement)lMyAppModuleAMImpl.getDBTransaction().createCallableStatement(lCallableProcedureStatement,
    0);
    lOracleCallableStatement.setARRAY(1, lTableArray);
    lOracleCallableStatement.setString(2,
    (String)ADFUtil.evaluateEL("#{sessionScope['UserName']}"));
    lOracleCallableStatement.executeUpdate();
    }

    That was helpful and now I can execute up to my last line of code: "lOracleCallableStatement.executeUpdate();"
    This code executes the SP.
    My SP is as follows:
    create or replace
    PROCEDURE          SP_TEST
    *( param1 IN TYP_TEST_TB,*
    param2 IN VARCHAR2) as
    CURSOR for_insert_csr IS
    SELECT *
    FROM TABLE(param1) T1;
    temp_update TYP_TEST_R;
    BEGIN
    FOR temp_update IN for_insert_csr
    LOOP
    -- do stuff in this loop
    END LOOP;
    end;
    When trying to execute the SP, I get the following error:
    +<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5+
    javax.el.ELException: oracle.jbo.JboException: java.sql.SQLException: ORA-06550: line 1, column 7:*
    PLS-00201: identifier DBADMIN.SP_TEST must be declared*
    ORA-06550: line 1, column 7:*
    PL/SQL: Statement ignored*
    at com.sun.el.parser.AstValue.invoke(Unknown Source)*
    at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)*
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1300)*
    at oracle.adf.view.rich.component.UIXDialog.broadcast(UIXDialog.java:97)*
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)*
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)*
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)*
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)*
    at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)*
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)*
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)*
    at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)*
    at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)*
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1018)*
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:386)*
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)*
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)*
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)*
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)*
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)*
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)*
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)*
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)*
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)*
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)*
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)*
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)*
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)*
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)*
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)*
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)*
    at java.security.AccessController.doPrivileged(Native Method)*
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)*
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)*
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)*
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)*
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)*
    Do you have any suggestions on what I might want to try?

  • Calling Stored Procedure with CLOB parameter

    Hi,
    i have one procedure with IN parameter CLOB which is taking xml file and stored in one table column and this table column datatype is also CLOB. And this procedure called by .Net program but problem is when the file will come more than 32KB calling procedure failed. But as i know CLOB can stored up to 4GB data.
    Is that Limitation of oracle or .Net version
    please let me know the solution for that,
    Create Procedure Insert_File(P_XMLFILE IN CLOB)
    as
    begin
    insert into instances
    values(p_xmlfile);
    commit;
    end;
    regards,
    Madan

    Hi Thanks for your reply,
    Actually this procedure called by .net program and the XML file has passed in that parameter which come from some FTP(its inbound) and this files we are storing into above mentioned table.
    Error has come while calling stored procedure Through .net
    Error Details:
    Error calling stored procedure. 0 retry attemps has failed. Error: System.Exception: Error while calling stored procedure on Oracle: INSERT_FILE: System.Data.OracleClient.OracleException: ORA-01460: unimplemented or unreasonable conversion requested

  • Call stored procedure

    Hi:
    I have a customer that wants to eliminate direct queries to enterprise databases and invoke stored procedures. This will ease maintenance issues down the line if underlying schema is changed. At any rate the Call Stored Procedure returns the number of rows affected by the call, not the result set(s).  I'm hoping I&apos;m missing something in the docs. There has to be a way to execute a stored procedure that returns the result sets.

    You're not missing anything. The current implementation of the stored procedure can only return the number of rows affected. They are looking at fixing that in the next release.
    The alternative is to use the Execute Script service and use jdbc code to execute your stored procedure. See http://forums.adobe.com/message/2302938#2302938 for an example.
    Jasmin

  • Error calling stored procedure from MFC using odbc

    Hello,
    I am using MFC to call a stored procedure written in PL/SQL, but when I make the call I get the next error in Spanish:
    "No se enlazaron columnas antes de llamar a SQLFetchScroll o SQLExtendedFetch", which more or less in English means:
    "No rows were binded before calling SQLFetchScroll or SQLExtendedFetch".
    I am using a CRecordset derived class to access the stored procedure. I am unable to find the error.
    THE STORED PROCEDURE'S HEADER:
    Sp_Int_Ot_Ordendetrabajoalta ( lineatrabajo NUMBER, lv_orden NUMBER, usuario
    VARCHAR2, idvehiculo NUMBER, fechamax1 VARCHAR2, resumen VARCHAR2, detalle
    VARCHAR2,
    coderp VARCHAR2, numtrabrecibidos NUMBER, lv_CODOT VARCHAR2, retorno OUT
    INTEGER)
    THE .H FOR THE CRECORDSET DERIVED CLASS (Visual Studio 6 comments removed)
    class CRecSP : public CRecordset
    public:
    CRecSP(CDatabase* pDatabase = NULL);
    DECLARE_DYNAMIC(CRecSP)
    CString m_szSQL;
    long m_RETORNO;
    virtual CString GetDefaultConnect();
    virtual CString GetDefaultSQL();
    virtual void DoFieldExchange(CFieldExchange* pFX);
    THE .CPP FOR THE CLASS (VS6 comments removed)
    IMPLEMENT_DYNAMIC(CRecSP, CRecordset)
    CRecSP::CRecSP(CDatabase* pdb) : CRecordset(pdb)
    m_RETORNO = 0;
    m_nParams = 1;
    m_nDefaultType = snapshot;
    CString CRecSP::GetDefaultConnect()
    return T( DBCONNECTION_STRING );
    CString CRecSP::GetDefaultSQL()
    return m_szSQL;
    void CRecSP::DoFieldExchange(CFieldExchange* pFX)
    pFX->SetFieldType(CFieldExchange::outputParam);
    RFX_Long(pFX, _T("[retorno]"), m_RETORNO );
    USING THE CRECORDSET DERIVED CLASS: (Vars read from EditBoxes as CStrings
    and formatted in the SQL)
    CRecSP *rec = new CRecSP(&db);
    szSQL.Format( "{CALL
    FGROT2005.SP_INT_OT_ORDENDETRABAJOALTA(%s,%s,'%s',%s,'%s','%s','%s','%s',%s,'%s',?)}",
    szLinea, szOrden, "USER", szIdVeh, szFechaMax, szResumen,
    szDetalle, "ERP", "0", szCodOT
    rec->m_szSQL = szSQL;
    //rec->Open( CRecordset::forwardOnly,szSQL,CRecordset::readOnly );
    rec->Open( );
    iError = rec->m_RETORNO;
    rec->Close();

    This forum is meant for discussions about OTN content/site and services.
    Questions about Oracle products and technologies will NOT be answered in this forum. Please post your product or technology related questions in the appropriate product or technology forums, which are monitored by Oracle product managers.
    Product forums:
    http://forums.oracle.com/forums/index.jsp?cat=9
    Technology forums:
    http://forums.oracle.com/forums/index.jsp?cat=10

Maybe you are looking for

  • I have itunes credit, but whenever i try to buy an app/song, it won't let me?!

    Hi, I have 25$ credit of itunes, as i redeemed a 25$ itunes gift card. However whenever i try to buy a song, I can't use the credit because the payment option goes to my sister's credit card account, and I have not updated the security code for her b

  • Help please: DAQWare or data logging software (multichannel data capture) questions

    I am writing regarding DAQWare, data logging software, and the PC-LPM-16 board, which a group of us a trying to come to grips with. This is rather lengthy, I'm afraid... We are a group of college students in a computer programmer/analyst program. We

  • Effects in and out points

    I'm working with Soundtrack version 2.0.2. In previous versions, when adding an effect to a channel - you could hit the "down arrow" on the track to reveal the volume and pan, etc, etc and the effect showed up as a purple line there that you could in

  • TutWD_EmailInteractiveForm_Init.zip password protected

    Hi, I am trying to start with a tutorial on offline interactive form based on sending and receiving emails and in this tutorial there is a reference to TutWD_EmailInteractiveForm_Init.zip that can be used as a starting point (it is a predefined web d

  • Digital media slot stop working

    I have a hp pavilion entertainment pc tx2500z windows 7 64bit, i was my digital media slot and it was working fine now it has just stop working. I have restarted the laptop tryed a different scan disk nonething works. Please help