OUTPUT parameter in procedures

Hi all,
What is the difference between OUT parameter in proc1 and porc2?
When I'm moving values to the output parameter from temp table, how it should be?
         OPEN result FOR
       SELECT emp_id empl_id_set
         FROM emp_table
create or replace proc1
p_id IN NUMBER,
"result OUT SYS_REFCURSOR"
create or replace proc2
p_id IN NUMBER,
"result OUT emp_table%ROWTYPE"
)Thanks,
Edited by: user10641405 on Jun 12, 2009 7:54 AM

Thank you so much.
Your answer really useful.
As I'm really new to PL/SQL programming,I got some more doubts from ur answer.
Please have a look at my below procedure (Some of forum people already femiliar with the proc :) .....still I'm struggling to solve this question. )
I pass the result to .NET.
PROCEDURE get_sitename_and_dir_lanes
     in_report_parameter_id   IN      report_tasks.report_task_id%TYPE,
     result_site_name         OUT     SYS_REFCURSOR,
     result                   OUT     SYS_REFCURSOR
AS
    CURSOR lane_numbers(c_site_id NUMBER, c_direction_id NUMBER) IS
       SELECT site_lane_id
      FROM site_lanes
         JOIN report_parameters
           ON site_lane_id = report_parameter_value
        WHERE site_lanes.site_id           = c_site_id
          AND site_lanes.site_direction_id = c_direction_id
          AND report_parameters.report_parameter_id  = in_report_parameter_id
          AND report_parameters.report_parameter_group = 'LANE'
       AND report_parameters.report_parameter_name  = 'LANE'
  ORDER BY site_lane_id;
     CURSOR direction_id IS
     SELECT site_direction_id
       FROM site_direction
       JOIN sites
         ON site_direction.site_id = sites.site_id
       JOIN report_parameters
         ON site_direction.site_id = report_parameter_value
      WHERE report_parameters.report_parameter_id  = in_report_parameter_id
           AND report_parameters.report_parameter_group = 'SITE'
        AND report_parameters.report_parameter_name  = 'SITE_ID'
   ORDER BY site_direction_id; 
  my_site_id sites.site_id%TYPE;      
  my_lane_numbers_string VARCHAR(100);
  my_site_name sites.short_name%TYPE;
  lane_numbers_d VARCHAR(200);
BEGIN
  my_site_id := edr_rpt_get_site_id(in_report_parameter_id);
  SELECT short_name
     INTO my_site_name
     FROM sites
     WHERE site_id = my_site_id;
  my_lane_numbers_string := '';
  FOR direction_id_row IN direction_id
  LOOP
         IF LENGTH(my_lane_numbers_string) > 0 THEN
            my_lane_numbers_string := my_lane_numbers_string || ',';
         END IF;
      FOR my_lane_number IN lane_numbers(my_site_id,direction_id_row.site_direction_id)
      LOOP
               my_lane_numbers_string := my_lane_numbers_string || my_lane_number.site_lane_id;
               insert into tmp_lanes_table values (my_lane_numbers_string);
       END LOOP;
  END LOOP; 
      open result_site_name for
      select my_site_name site_name
      from sys.dual;
         OPEN result FOR
       SELECT lane_id lane_numbers_d
         FROM tmp_lanes_table;
END get_site_and_dir_lanes;During runtime, I got error as
PLS-00306: wrong number or types of arguments in call to 'GET_SITENAME_AND_DIR_LANES'When I had look for this error, I found one answer from previous post as , I need to do some change in OUT paramter.
Even from the good answers, I cant figure out what to do. I want multiple rows of record should get move to .NET(1.I want all lane id's in each directions should get move to .NET ,and 2.Site name ). Is my procedure is good one?
You told about single row.Please clear me.
If you ahev a look at procedure, you could suggest me
Edited by: user10641405 on Jun 12, 2009 8:42 AM

Similar Messages

  • Getting error while Calling Oracle Stored Procedure with output Parameter

    HI All,
    From long days i am working on this but i unable to solve it.
    Even i have studied so many forums in SAP but i didn't find the solution.
    I am calling Oracle Store procedure with 3 inputs and 1 output without cursor.
    Store Procedure:-
    CREATE OR REPLACE PROCEDURE PDS.send_rm
    IS
    proc_name           VARCHAR2(64) := 'send_rm';
    destination_system  VARCHAR2(32) := 'RAWMAT';
    xml_message         VARCHAR2(4000);
    status_code         INTEGER;
    status_message      VARCHAR2(128);
    debug_message       VARCHAR2(128);
    p_ret               INTEGER;
    BEGIN
      DBMS_OUTPUT.PUT_LINE( proc_name || ' started' );
      xml_message := '<RAW_MATERIAL>'||
                     '<BAR_CODE>10000764601</BAR_CODE>'||
                     '<MATERIAL>1101448</MATERIAL>'||
                     '<VENDOR_CODE/>'||
                     '<PRODUCTION_DATE>0000-00-00</PRODUCTION_DATE>'||
                     '<EXPIRE_DATE>0000-00-00</EXPIRE_DATE>'||
                     '<BATCH/>'||
                     '<PO_NUM/>'||
                     '<MATERIAL_DESCRIPTION>POWER SUPPLY</MATERIAL_DESCRIPTION>'||
                     '<SPEC_NAME/>'||
                     '<STOCK_CODE>BSW-JH</STOCK_CODE>'||
                     '<INSPECTION_LOT>00</INSPECTION_LOT>'||
                     '<USAGE_DECISION_CODE/>'||
                     '<MATERIAL_GROUP>031</MATERIAL_GROUP>'||
                     '</RAW_MATERIAL>';
          dbms_output.put_line('XML '||xml_message);
    --      vp_interface.load_rawmat@cnprpt1_pds(SYSDATE, destination_system,
    --                   xml_message, p_ret);
          vp_interface.load_rawmat(SYSDATE, destination_system,
                       xml_message, p_ret);
          dbms_output.put_line('Return Code '||p_ret);
          COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
        status_code := SQLCODE;
        status_message := SUBSTR(SQLERRM, 1, 64);
    --    Extract_Error_Logger(proc_name, 'LOCAL', SYSDATE, -999,
    --                         status_message, 0, debug_message);
        ROLLBACK;
    END send_rm;
    And while i am calling this Store procedure in MII, I am facing error.
    I have tried different ways but didnt solved
    In SQL Query, i kept mode as: FixedQueryOutput
    Can anyone tell me or send code for calling above store procedure
    And onemore thing, While creating store procedure in Oracle for MII. Do we need to Create output parameter as cursor or normal.  
    Thanks,
    Kind Regards,
    Praveen Reddy M

    Hi Praveen
    Our wrapper was created because we could not modify the procedure we call (it was not returning a cursor).
    CREATE OR REPLACE PROCEDURE CHECK_PUT_IN_USE
    (STRCMPNAME in varchar2,
    STRSCANLABEL in varchar2,
    RCT1 out SYS_REFCURSOR
    AS
      charDispo          Char(1);
      charStatus          Char(1);
      intCatNo          Integer;
      charCatDispo     Char(1);
      strCatQual          VarChar2(2);
      strCatDesc          VarChar2(30);
      strMsg          VarChar2(128);
    BEGIN
    qa.check_put_in_use@AR(STRCMPNAME,
                                              STRSCANLABEL,
                                              charDispo,
                                              charStatus,
                                              intCatNo,
                                              charCatDispo,
                                              strCatQual,
                                              strCatDesc,
                                              strMsg);
    OPEN RCT1
    FOR Select charDispo,charStatus,charDispo,charStatus,intCatNo,charCatDispo,strCatQual,strCatDesc,strMsg from Dual;
    END;
    Hope this helps
    Regards
    Amrik
    then with a FixedQueryWithOutput
    call mixar.qasap.wrapper_update_put_in_use('[Param.1]','[Param.2]',[Param.3],?)
    Hope this helps.

  • How to call a Stored Procedure with a REF CURSOR output parameter

    I am looking forward an example that call a stored function/procedure with a REF CURSOR output parameter and get the result.
    In other words, I have a stored function/procedure that execute a SELECT statement using the OCI library and then it could get the values of each column and each row.
    I put a code snippet, it have only the main thing to call a simple stored procedure and print the name of each column of the cursor, but I couldn´t to print out the values in the table that call the stored procedure.
    I understand that the next step, it is to call a OCIStmtFetch.
    How to associate the cursor with the OCIStmtFetch?
    If you need more information, only tell me.
    I am using ANSI C with HP-UX Operative System (C for HP-UX) and Oracle 10g.
    Regards.
    Antonio Garcia
    /* callOracleSP */
    #include <stdio.h>
    #include <string.h>
    #include <oci.h>
    #include <stdlib.h>
    char* pConnectChar ="server";
    char* pUsernameChar = "user";
    char* pPasswordChar = "passwd";
    char* sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
    int retval;
    ub4 parmcnt=0;
    ub4 pos2=0;
    text *pcoln[20];
    ub4 namelen[20];
    char state_key[5];
    OCIStmt* pOciStatement;
    OCIStmt* pOciStatCursor;
    OCIError* pOciError;
    OCIEnv* pOciEnviron;
    OCIServer* pOciServer;
    OCISession* pOciSession;
    OCISvcCtx* pOciServiceContext;
    OCIBind* pOciBind[500];
    OCIParam* pOciParam;
    int main()
    retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
    retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
    retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
         strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
                   (unsigned char *)pConnectChar,strlen(pConnectChar));
    printf("OCILogon retval=%d\n",retval);
    retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
         OCI_NTV_SYNTAX, OCI_DEFAULT);
    printf("StmtPrepare retval=%d\n",retval);
    retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
    retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
         (sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
    printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
    retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
         (sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
    printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
    strcpy(state_key,"CA");
    retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
         (OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
    printf("StmtExecute retval=%d\n",retval);
    /* How to get the values of the cursor? */
    /* Get number of parameters of the Cursor */
    OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
         (ub4)OCI_ATTR_PARAM_COUNT, pOciError);
    printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
    for (int pos = 1; pos <= (int)parmcnt; pos++)
         OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
              (ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
         retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,
              (ub4) pos );
         OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &pcoln[pos-1],(ub4 *) &namelen[pos-1],
              (ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
    for (int i = 1; i <=(int)parmcnt; i++)
    printf("Column %i\tNAME = %.*s\n",i,namelen[i-1],pcoln[i-1]);
    return 0;
    This is the script that create the table, insert records and create the stored procedure
    CREATE TABLE CITIES (
         STATE_CODE     VARCHAR2(2) NULL,
         CITY_CODE      NUMBER(15,5) NULL,
         CITY_NAME      VARCHAR2(30) NULL
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 30, 'SAN DIEGO')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 40, 'SACRAMENTO')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('FL', 10, 'MIAMI')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('FL', 20, 'ORLANDO')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('NY', 10, 'NEW YORK')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('NY', 20, 'ALBANY')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 10, 'LOS ANGELES')
    INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES('CA', 20, 'SAN FRANCISCO')
    CREATE OR REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
    /* The following are T/SQL specific global variables. */
    TYPE RCT1 IS REF CURSOR;/*new weak cursor definition*/
    END globalPkg;
    CREATE OR REPLACE PROCEDURE SP_ADDCITY(
    P_STATE_CODE IN VARCHAR,
    P_CITY_CODE      IN NUMBER,
    P_CITY_NAME      IN VARCHAR2,
    P_RETURN IN OUT NUMBER)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
         BEGIN
    StoO_rowcnt := 0;
    StoO_error := 0;
    StoO_selcnt := 0;
    P_RETURN := 0;
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN TOO_MANY_ROWS THEN
    StoO_rowcnt := 2;
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_selcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
              IF StoO_error != 0 THEN
    BEGIN
                   P_RETURN := 1;
         RETURN;
         END;
              END IF;
         END;
    CREATE OR REPLACE PROCEDURE SP_GETCITIES(
    STATE_KEY IN VARCHAR,
    RC1      IN OUT globalPkg.RCT1)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    BEGIN
    StoO_rowcnt := 0;
    StoO_error := 0;
    StoO_selcnt := 0;
    OPEN RC1 FOR
    SELECT STATE_CODE, CITY_CODE, CITY_NAME
    FROM CITIES
    WHERE STATE_CODE = STATE_KEY
    ORDER BY CITY_CODE;
    StoO_rowcnt := SQL%ROWCOUNT;
    EXCEPTION
    WHEN OTHERS THEN
    StoO_rowcnt := 0;
    StoO_error := SQLCODE;
    StoO_errmsg := SQLERRM;
         END;
    /

    Hi Mark,
    Thanks for your recommendations.
    I change the code with OCIDefineByPos, one for each parameter from cursor and then use the OCIStmtFetch.
    I don´t receive a error when call OCIDefineByPos, but when I call OCIStmtFetch receive a -1 error number.
    What is wrong with the code?
    The script is the same.
    I need your help!
    Best Regards!
    Antonio Garcia (Mexico)
    This the new code:
    #include <stdio.h>
    #include <string.h>
    #include <oci.h>
    #include <stdlib.h>
      char*   pConnectChar ="ORAC617";
      char*   pUsernameChar = "C617_005_DBO_01";
      char*   pPasswordChar = "Tempora1";
      char*   sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
      int     retval;
      ub4 parmcnt=0;
      ub4 pos2=0;
      sb2   *c_indp;
      text *pcoln[20], *name,*name2;
      ub4 namelen[20],len;
      ub2 type,size;
      char state_key[5];
      OCIDefine        *pdef;
      OCIBind          *p_bnd;
      ub1          **c_buf;
      OCIStmt*     pOciStatement;      /* Statement handle */
      OCIStmt*     pOciStatCursor;     /* Statement handle */   
      OCIError*    pOciError;          /* Error handle */
      OCIEnv*      pOciEnviron;        /* Environment handle */
      OCIServer*   pOciServer;         /* Server handle */  
      OCISession*  pOciSession;        /* Session handle */
      OCISvcCtx*   pOciServiceContext; /* Service Context handle */
      OCIBind*     pOciBind[500];      /* Bind handle */
      OCIParam*    pOciParam;          /* Param handle */
      int OCI_Fetch(OCIStmt *p_select,OCIError *p_err, int *piOcc)
      int iOcc, rc; 
      rc=OCIStmtFetch(p_select,p_err,1,OCI_FETCH_NEXT,OCI_DEFAULT);
      printf("rc fetch %i",rc);
      if(rc==0&&piOcc!=NULL){
           printf("entro al if");
        iOcc=*piOcc;
        *piOcc=iOcc+1;
      return rc;
    int main()
    int pos,i=0,rc;
      retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
      printf("EnvCreate retval=%d\n", retval);
      retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
      printf("EnvInit retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_ERROR retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_SVCCTX retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
      retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
                  strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
                    (unsigned char *)pConnectChar,strlen(pConnectChar));
      printf("OCILogon retval=%d\n",retval);
      retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
                 OCI_NTV_SYNTAX, OCI_DEFAULT);
      printf("StmtPrepare retval=%d\n",retval);
      retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
      printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
      retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
                 (sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
      printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
      retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
                 (sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
      printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
      strcpy(state_key,"CA");
      retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
                   (OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
      printf("StmtExecute retval=%d\n",retval);
      c_buf=(ub1 **)calloc(sizeof(ub1 *),3);
      c_indp=(sb2 *)calloc(sizeof(sb2 *),3);
      // Get number of parameters of the Cursor
      OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
                  (ub4)OCI_ATTR_PARAM_COUNT, pOciError);
      printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
      for (pos = 1; pos <= (int)parmcnt; pos++)
           OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
                (ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
           retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,(ub4) pos );
           // Get the column name
           OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &name,(ub4 *) &len, (ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
            // Get the column datatype
           OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &type,(ub4 *)0,(ub4)OCI_ATTR_DATA_TYPE,(OCIError *)pOciError);      
            // Get the column size
           OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &size,(ub4 *)0,(ub4)OCI_ATTR_DATA_SIZE,(OCIError *)pOciError);
           printf("Column %i\tNAME = %.*s \ttype %d \tsize %d\n",pos,len,name,type,size);
           // OCIDefine ByPos, one for each parameter
           // c_buf store the STATE_CODE, CITY_CODE and CITY_NAME columns from the cursor
           rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);     
          printf("OCIDefineByPos retval=%d\n,rc);
      // call OCIStmtFetch. In the next line, I receive the error
      rc=OCIStmtFetch(pOciStatCursor,pOciError,1,OCI_FETCH_NEXT,OCI_DEFAULT);
      printf("rc fetch %i",rc);
      return 0;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Calling Stored Procedure with Boolean Output Parameter

    Hi all,
    I'm running into an issue (or is it a BUG) when calling a Database Stored Procedure that has an output parameter of the boolean type.
    procedure proc(p_text in varchar2, p_result out boolean)
    is
    .....I use the following 'standard' code (developer guide 36-19 36-20) to invoke this procedure from my application module.
            try {
                // 1. Define the PL/SQL block for the statement to invoke
                String stmt = "begin proc(?,?); end;";
                // 2. Create the CallableStatement for the PL/SQL block
                st = getDBTransaction().createCallableStatement(stmt, 0);
                // 3. Register the positions and types of the OUT parameters
                st.registerOutParameter(2, Types.BOOLEAN);
                // 4. Set the bind values of the IN parameters
                st.setObject(1, "Some text");
                // 5. Execute the statement
                st.executeUpdate();
                ..............................As soon as 'st.registerOutParameter(2, Types.BOOLEAN);' is invoked I run into a SQLexception. "Invalid ColumnType: 16". Obviously 16 refers to Types.BOOLEAN.
    [edit by Luc]
    SOLUTION / WORKAROUND
    To answer my own question.
    It looks like BOOLEAN output parameters are not supported. I just Read "Appendix D Troubleshooting" of the Oracle® Database JDBC Developer's Guide and Reference 10g Release 2 (10.2).
    I found that JDBC drivers do not support the passing of BOOLEAN parameters to PL/SQL stored procedures. If a PL/SQL procedure contains BOOLEAN values, you can work around the restriction by wrapping the PL/SQL procedure with a second PL/SQL procedure that accepts the argument as an INT and passes it to the first stored procedure. When the second procedure is called, the server performs the conversion from INT to BOOLEAN.
    I'm not very happy with this but I guess I've no choice.
    Regards Luc
    Edited by: lucbors on Nov 30, 2010 10:37 AM

    fyi
    Related to the solution/workaround posted by Luc.
    see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
    at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
    regards
    Jan Vervecken

  • Calling an oracle stored procedure with output parameter

    Hi,
    I am trying to execute a procedure with 2 input and 1 output parameters by using SQLQuery. I tried each mode (Command, FixedQuery & FixedQueryWithOutput) with following statements.
    call cm_test_prod([Param.1],[Param.2],[Param.3])
    Error:"missing expression "
    call cm_test_prod([Param.1],[Param.2],?)
    Error:"wrong number or types of arguments in call to 'CM_TEST_PROD'"
    call cm_test_prod([Param.1],[Param.2],:var)
    Error:"wrong number or types of arguments in call to 'CM_TEST_PROD' "
    or
    Error: "not all variables bound"
    If I use without output parameter, in Command mode, It works fine.
    call cm_test_prod([Param.1],[Param.2])
    or
    call cm_test_prod('[Param.1]','[Param.2]')
    works without error.
    SAP XMII: Version 12.0.5 Build(126)
    Oracle 10G
    Any help would be greatly appreciated.
    Thanks,
    Tunur.
    Edited by: Namik Tunur on Dec 14, 2010 3:34 PM
    Edited by: Namik Tunur on Dec 14, 2010 3:36 PM

    Hi,
    @Marcelo,
    I  used your package just by replacing 'varchar2' instead of 'varchar(100)''. I got the error message 'ORA-00900: invalid SQL statement'. I didn't understand how we handle output parameter with this:
    Query = Call MYPKG.MyProcedure(1,'Test FixedQueryWithOutput',?)
    What is Query in here? If we have two output parameters, how would we get the outputs?
    My procedure is:
    CREATE OR REPLACE
    PROCEDURE XXXXX.CM_TEST_PROD_OUTPUT(v1 in number,v2  in number, v3 out number) IS
    BEGIN
      update test_table set no2 = (v1+v2);
      commit;
      v3 := v1+v2;
    END;
    declare
    a number;
    BEGIN
      cm_test_prod_output(1,6,a);
    END;
    if I use this
    call cm_test_prod_output([Param.1],[Param.2],?)
    with FixedQueryWithOutput mode,
    I get the following error:
    ORA-06553: PLS-306: wrong number or types of arguments in call to 'CM_TEST_PROD_OUTPUT'
    @Mike,
    I already tried both with quotes and without quotes, also I tried both with number output and with string output.
    As I mentioned before, if I use number inputs without output in Command mode,
    call cm_test_prod(http://Param.1,http://Param.2)
    or
    call cm_test_prod('http://Param.1','http://Param.2')
    works succesfully.
    Regards,
    Tunur

  • How to retrieve Stored Procedure Output Parameter?

    Hi,
    I'm using a stored procedure with MS SQL Server. The stored procedure creates the required table entries correctly. After executing the procedure i free the resulting recordset reference and am able to retrieve the return value of the stored procedure. However,
    I am not able to retrieve the output parameters of the procedure. I am connected to the database using the MS OLE DB Provider for SQL Server. I tried using ODBC as well. Didn't work either. I know this issue has been addressed before, did anyone come up with a solution for this problem?
    Thanks in advance,
    Marco

    I can tell you what I do with LabSQL and a single output parameter. After I open the connection to the database, I execute a SQL statement that looks like this:
    declare @resultID int
    execute spInsUUTResult @SerialNumber = '999DEBUGXXX',
    @SequenceName = 'Sequence File2.seq',
    @CategoryID = 2,
    @TypeID = 1,
    @StartDateTime = '10-10-2003 13:42:45',
    @ExecutionTime = 3.5698713,
    @UUTStatus = 'Passed',
    @UserName = 'Dennis Knutson',
    @StationName = 'DENNIS-KNUTSON',
    @UUTResultID = @resultID OUTPUT
    This query result is the output parameter. I first debugged the call to the stored procedure in the SQL Server Query Analyzer and then just copied that straight into my LabVIEW code. You may be using something other than LabSQL but you should have a function t
    hat allows for raw SQL commands.

  • Is it possible to pass TABLE as the output parameter in stored procedure

    Hey Experts,
      Is it possible to pass TABLE as the output parameter in stored procedure.
    eg
    create procedure spGetData
    @tableName as TABLE(intValue INT NOT NUL)
    as 

    You can use OPENQUERY or OPENROWSET, as mentioned above, to make stored procedure results table like. There are
    some limitations with these methods:
    http://technet.microsoft.com/en-us/library/ms188427.aspx
    In OPENQUERY this-sql-server-instance can be used instead of a linked server name. It requires setting data accces server option:
    exec sp_serveroption @server = 'PRODSVR\SQL2012'
    ,@optname = 'DATA ACCESS'
    ,@optvalue = 'TRUE'
    LINK: http://www.sqlusa.com/bestpractices/select-into/
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Stored procedure output parameter cast problem - there was a mistake in the

    Hi
    I call to an oracle stored procedure from java and when i get the output parameter i get a classCastException.
    The output parameter is for example of typeA
    typeA is a sql object composed by a parameter of typeB and a parameter of typeC
    typeC is a sql table of typeD objects
    and typeD, typeB are objects composed by numbers, varchar2, date.....
    I know that i have all the java to sql mappings correctly done because when my typeA is an input parameter of a procedure, it works correctly.
    But when i have it as an output parameter i can�t solve the classCastException.
    This is more or less my java code to call to the procedure:
    dbConn=DriverManager.getConnection(dnsName,dnsUser,dnsPwd);
    Map map = dbConn.getTypeMap();          
    map.put("TYPEA", Class.forName("tiposOracle.inv.Inv"));               
    map.put("TYPEB", Class.forName("tiposOracle.inv.Inv_cab"));               
    map.put("TYPED", Class.forName("tiposOracle.inv.Inv_lin"));
    CallableStatement cstmt = dbConn.prepareCall("{call GENERAL.OBTENER_MENSAJE (?,?)}");
    cstmt.setBigDecimal(1, codMensaje);
    cstmt.registerOutParameter(2, OracleTypes.STRUCT, "TYPEA");
    cstmt.execute();
    Inv inv = (Inv)cstmt.getObject(2,map);       ////////Here the exception-----------------------------------------------------------------------------------------------
    The java class Inv represents the sql object typeA as this:
    public Inv_cab cab;
    public ARRAY lins;
    And the classes Inv_cab and Inv_lin typeB and typeD with dates, BigDecimals and String.
    lins is the table of Inv_lin.
    And finally, this is the exception i get:
    java.lang.ClassCastException
    at tiposOracle.inv.Inv.readSQL(Invrpt.java:29)
    at oracle.sql.STRUCT.toClass(STRUCT.java:829)
    at oracle.sql.STRUCT.toJdbc(STRUCT.java:734)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6094)
    at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:840)
    at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:103)
    Can anyone help me?
    Thanks

    Now i get this exception in cstmt.registerOutParameter(2, OracleTypes.STRUCT);java.sql.SQLException: Conflicto de tipo de par�metro: sqlType=2002
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:248)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:402)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:471)
         at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:78)
    Conflicto de tipo de par�metro means: conflict of parameter type

  • Stored procedure output parameter cast problem

    Hi
    I call to an oracle stored procedure from java and when i get the output parameter i get a classCastException.
    The output parameter is for example of typeA
    typeA is a sql object composed by a parameter of typeB and a parameter of typeC
    typeB is a sql table of typeD objects
    and typeD, typeB are objects composed by numbers, varchar2, date.....
    I know that i have all the java to sql mappings correctly done because when my typeA is an input parameter of a procedure, it works correctly.
    But when i have it as an output parameter i can�t solve the classCastException.
    This is more or less my java code to call to the procedure:
    dbConn=DriverManager.getConnection(dnsName,dnsUser,dnsPwd);
    Map map = dbConn.getTypeMap();          
    map.put("TYPEA", Class.forName("tiposOracle.inv.Inv"));               
    map.put("TYPEB", Class.forName("tiposOracle.inv.Inv_cab"));               
    map.put("TYPED", Class.forName("tiposOracle.inv.Inv_lin"));
    CallableStatement cstmt = dbConn.prepareCall("{call GENERAL.OBTENER_MENSAJE (?,?)}");
    cstmt.setBigDecimal(1, codMensaje);
    cstmt.registerOutParameter(2, OracleTypes.STRUCT, "TYPEA");
    cstmt.execute();
    Inv inv = (Inv)cstmt.getObject(2,map);       ////////Here the exception-----------------------------------------------------------------------------------------------
    The java class Inv represents the sql object typeA as this:
    public Inv_cab cab;
    public ARRAY lins;
    And the classes Inv_cab and Inv_lin typeB and typeD with dates, BigDecimals and String.
    lins is the table of Inv_lin.
    And finally, this is the exception i get:
    java.lang.ClassCastException
         at tiposOracle.inv.Inv.readSQL(Invrpt.java:29)
         at oracle.sql.STRUCT.toClass(STRUCT.java:829)
         at oracle.sql.STRUCT.toJdbc(STRUCT.java:734)
         at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6094)
         at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:840)
         at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:103)
    Can anyone help me?
    Thanks

    Now i get this exception in cstmt.registerOutParameter(2, OracleTypes.STRUCT);java.sql.SQLException: Conflicto de tipo de par�metro: sqlType=2002
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:248)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:402)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:471)
         at principal.PedirDatosMensaje.main(PedirDatosMensaje.java:78)
    Conflicto de tipo de par�metro means: conflict of parameter type

  • Procedure output parameter with OCI

    Hi everyone,
    Is it possible to get the value of an output parameter calling a procedure with OCI?
    Regards.
    Carl

    yes, with a bind.
    prepare "begin myproc( :outvar ); end;"
    bindbyname outvar
    execute

  • How to check for null value of output parameter?

    Hi guys, I get a test procedure with 2 output parameters and do nothing:
    CREATE OR REPLACE PACKAGE BODY p_parameters_test AS
      PROCEDURE p_null_output_basetype(p1 OUT NUMBER,p2 OUT VARCHAR2)
      AS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('DO NOTHING');
      END p_null_output_basetype;
    END;And I have below C# code:
    cmd.CommandText = "p_parameters_test.p_null_output_basetype";
    OracleParameter p1 = new OracleParameter("p1", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
    OracleParameter p2 = new OracleParameter("p2", OracleDbType.Varchar2, System.Data.ParameterDirection.Output);
    cmd.Parameters.Add(p1);
    cmd.Parameters.Add(p2);
    try
        conn.Open();
        cmd.ExecuteNonQuery();
        if (p1.Value==null)
            Console.WriteLine("p1.Value==null");
        else if (Convert.IsDBNull(p1.Value))
            Console.WriteLine("Convert.IsDBNull(p1.Value)");
        else
            Console.WriteLine("p1 else "+p1.Value);
        if (p2.Value==null)
            Console.WriteLine("p2.Value==null");
        else if (Convert.IsDBNull(p2.Value))
            Console.WriteLine("Convert.IsDBNull(p2.Value)");
        else
            Console.WriteLine("p2 else "+p2.Value);
        Console.WriteLine("finished");
    catch......The output of it is:
    p1 else null
    p2 else null
    Does anyone have any idea why it always goes to the 'else' of the condition-branching, and how can I check if the output parameter is null?
    Thanks in advance.

    Morven... I ran into similar problems. Maybe you've found a solution of your own by now, but here's what I've learned...
    The Value property of output parameters, like p1 and p2 in your code, actually varies, according to (I think) the OracleDbType of the parameter. You've got OracleDbType.Decimal for p1 and OracleDbType.Varchar2 for p2. These look about right, since they match the parameter types in your actual stored procedure.
    After cmd.ExecuteNonQuery() executes, the respective Value properties of p1 and p2 are actually of different types. For p1, it's going to be "OracleDecimal" and for p2 it's "OracleString". Keep in miind that these are the types of the Value property of the OracleParameter objects, not the OracleParameter objects themselves.
    OracleDecimal and OracleString (and some other types like OracleDate, etc.) have an "IsNull" property you can use if you cast the Value property to its runtime type...
    if ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull) { …do something… }
    else { …do something else… }
    Or maybe something like this...
    Decimal p1val = ((OracleDecimal)cmd.Parameters["p1"].Value).IsNull ? 0 : ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value;
    I'll admit that expressions like this: ((OracleDecimal)cmd.Parameters["AVG_SALARY"].Value).Value look a little weird. But the "Value" of the "OracleDecimal" property is a regular .NET decimal type (System.Decimal). So, it's a "Value" of the "Value" property of the OracleParameter class.
    Even when the stored procedure returns a null, the Value property is still populated. In the case of p1, it's populated with an OracleDecimal object (actually a struct) where IsNull is true. That's why "p1.Value==null" tests false.
    From what I can see, OracleDecimal, OracleString, etc. will never be typed as DbNull, or DBNull.Value. So, that would be why Convert.IsDBNull(p1.Value)) always returns false. btw, it appears that these are Value types. That would suggest that coding something like like this, should be avoided…
    OracleString p2val = ((OracleString)cmd.Parameters["p2"].Value;
    if (p2val.IsNull) { …do something… }
    else { …do something else… }
    By assigning the value to another variable, you’d be actually creating an entire copy of the OracleString structure, which is pointless.
    I hope that helps
    Edited by: 897674 on Jan 3, 2012 10:44 AM
    Edited by: 897674 on Jan 3, 2012 10:46 AM

  • Associative Array with more than one field - retrieving as output parameter

    Hello,
    I'm developing an C# Application that is showing a datagrid with results from a PL/SQL procedure inside a Package.
    The .net project is in .net 4 and the DB is an oracle 10g.
    I have read the odp.net sample about the associative array. I could successfully pass as an input parameter a string[] and dealing with it inside my PL/SQL procedure.
    Now it become more complex to me because I would like to return an associative array defined like this :
    TYPE r_FinalExtract IS RECORD
    RecordmyTable myTable%ROWTYPE,
    Tel1 varchar2(25),
    Tel1Libelle varchar2(50),
    Tel2 varchar2(25),
    Tel2Libelle varchar2(50),
    Tel3 varchar2(25),
    Tel3Libelle varchar2(50),
    Tel4 varchar2(25),
    Tel4Libelle varchar2(50),
    Tel5 varchar2(25),
    Tel5Libelle varchar2(50),
    Email1 varchar2(50),
    Email1Libelle varchar2(50),
    Email2 varchar2(50),
    Email2Libelle varchar2(50)
    TYPE t_FinalExtract IS TABLE OF r_FinalExtract INDEX BY BINARY_INTEGER;
    You can guess my PL/SQL stored procedure is filling this collection.
    The spec of my procedure :
    PROCEDURE P_SELECTDATA( ptab_ListRef IN t_AssocArrayVarchar2, ptab_Result OUT t_FinalExtract );
    Unfortunately, in my .net project, I don't know how to deal with that.
    I tryed to add p_Result as an output parameter but you have to define the OracleCollectionType for that parameter and the array type is not the good one because my t_FinalExtract is not a simple array...
    I searched over the internet and the only one thread I could find is someone who was doing like me... and finally reply to his own thread 3 months later and said that he had to create CSV lines and return a table of varchar2...
    This is what I will do because I'm loosing time for finding the way to do it with my associative array, but if someone has the solution I would be glad to read it.
    Thanks in advance.

    For PL/SQL records, I would recommend using User-Defined Types (UDTs), rather than associative arrays.
    You can read more on how to use ODP.NET UDTs here:
    http://docs.oracle.com/cd/E20434_01/doc/win.112/e23174/featUDTs.htm#CJAGCAID
    Strictly speaking, ODP.NET doesn't support PL/SQL Records per se. Instead, ODP.NET supports building any generic UDT in the Oracle DB, which covers the effective functionality of a Record.
    If you want to walk through the process of taking a sample DB UDT, generating a .NET custom class, then passing an instance between DB and application, here's a tutorial that shows you how to do that:
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/userdefinedtypes/userDefinedTypes.htm

  • VARRAY as Stored Proc output parameter

    VARRAY as Stored Proc output parameter
    I have an Oracle VARRAY data type declared as follows:
    CREATE TYPE NUMBER_ARRAY AS VARRAY(100) OF NUMBER;
    I have a stored procedure which takes a single input and
    returns a NUMBER_ARRAY as output:
    CREATE OR REPLACE PROCEDURE one_in_number_array_out(
    IN_PARAM IN NUMBER,
    OUT_NUMBER_ARRAY OUT NUMBER_ARRAY )
    IS
    BEGIN
    -- OUT_NUMBER_ARRAY getting populated here
    END one_in_number_array_out;
    I want to be able hit this proc using TopLink StoreProcedureCall objects and retrieve through a map.
    I thought I would be able to do something like:
    public void execute() {
         StoredProcedureCall call = new StoredProcedureCall();
              call.setProcedureName( getStoredProcedureName() );
              call.addNamedArgumentValue("IN_NUMBER_PARAM", new Double(324) );
              call.addNamedOutputArgument("OUT_NUMBER_ARRAY", "numberArray"); // use an alias
         ClientSession clientSession = .....getClientSession();
    // EXCEPTION OCCURS on following call:
              Map row = (Map) clientSession.executeSelectingCall( call ).firstElement();
              Object numberArray = row.get( "numberArray" );
              System.out.println("numberArray = " + numberArray);
    But, when I call the stored proc I get the following stack trace:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-4002] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'ONE_IN_NUMBER_ARRAY_OUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    INTERNAL EXCEPTION: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'ONE_IN_NUMBER_ARRAY_OUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    ERROR CODE: 6550
         at oracle.toplink.exceptions.DatabaseException.sqlException(Unknown Source)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown Source)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
         at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelect(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.executeNonCursor(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.ReadQuery.execute(Unknown Source)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ServerSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ClientSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeSelectingCall(Unknown Source)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.OneInNumberArrayOutStoredProcedure.execute(OneInNumberArrayOutStoredProcedure.java:51)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.PracticeStoredProceduresTest.testOneInNumberArrayOutStoredProcedure(PracticeStoredProceduresTest.java:54)
         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:324)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)
    INTERNAL EXCEPTION STACK:
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'ONE_IN_NUMBER_ARRAY_OUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(Unknown Source)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(Unknown Source)
         at oracle.toplink.threetier.ServerSession.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(Unknown Source)
         at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelect(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.executeNonCursor(Unknown Source)
         at oracle.toplink.queryframework.DataReadQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
         at oracle.toplink.queryframework.ReadQuery.execute(Unknown Source)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ServerSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.threetier.ClientSession.internalExecuteQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
         at oracle.toplink.publicinterface.Session.executeSelectingCall(Unknown Source)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.OneInNumberArrayOutStoredProcedure.execute(OneInNumberArrayOutStoredProcedure.java:51)
         at com.gs.lab.rr.db.plsql.gs_practice_pkg.PracticeStoredProceduresTest.testOneInNumberArrayOutStoredProcedure(PracticeStoredProceduresTest.java:54)
         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:324)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)
    Thanks in advance,
    John

    Using the SQL/ObjectRelational types as stored procedure arguments is not supported. But it may work...
    You should not pass in the reference to the array type. Instead, do something like this:
    call.addNamedOutputArgument("OUT_NUMBER_ARRAY", "OUT_NUMBER_ARRAY");
    Hope this helps. If not, I suspect it would take some technical services to do this as I don't think the source.zip contains the classes involved in this.
    - Don

  • REST Web Service Output Parameter not working in POST Handler

    I've created a RESTful Web Service in Oracle Apex, using a POST method as "handler".   I've setup 11 input parameters which all work fine, it is my one output parameter that does not return successfully.
    Here is detail on the Output Paramter
    Name:  returns
    Bind Variable Name:  :returns
    Access Method:  OUT
    Source Type: Response
    Parameter Type:  String
    The actual source is a call to a pl/sql package that returns a value that I set :returns equal to (eg :returns := v_result).   I've tried this with Source Type Header and still the same result, 'no output'.
    I see APEX is calling wwv_flow_api.create_restful_param to generate the parameters (for importing), is there any documentation on this procedure?
    How can I get this output parameter to return something in the response?
    The request accepts a Json payload.
    Any help greatly appreciated
    Thanks,
    James

    Solved my own problem :returns does not work needs to be returns
    Does Not Work
    Name:  returns
    Bind Variable Name:  :returns
    Access Method:  OUT
    Source Type: Response
    Parameter Type:  String
    Does Work
    Name:  returns
    Bind Variable Name:  returns
    Access Method:  OUT
    Source Type: Response
    Parameter Type:  String

  • How to use Oracle refcursor dataset output parameter from SP

    Can I request for help on how to use Oracle Output parameter from a stored procedure as a source. I need the output tobe stored in a flat file
    Thanks
    Abhijit
    Message was edited by:
    Abhijit77

    yes I would like to use it for ODI.. I would like the ouput of the refcursor to be fed to a text file using ODI. How to handle the records returned by the refcursor and map with txt file.

Maybe you are looking for

  • Libretto W105 first impression​s

    I received my Toshiba Libretto W105 (the dual screen computer) today. So far the quality of my user experience is mixed. (There isn't a Libretto forum, apparently, so I'm posting here. Feel free to move this post if necessary.) Summary Is the Librett

  • Monitor image reduced to bright vertical line

    I have a 10 month old Sun PN21MS monitor. It was in power save mode all weekend, and when I "woke up" the computer this morning, I only got a single bright vertical line on the display, instead of the normal image. Power cycling restored a normal ima

  • Java Web Service with Java 1.4

    I had been using JAX-RPC (DII) and Dynamic Proxy to call Sharepoint web service. I can make it work with static web service but not dynamic web service. I am just seeking for other web service technology to work on dynamic web service. Do you think A

  • Accessing user-defined context variables when chaining Proxies

    We have a Proxy Service, A, which routes to a ProxyService B, which does some routing and XML transformation. When an error is raised, the error text is assigned to a variable and the Error Handler for Proxy Servce B assigns soap fault XML to the bod

  • Older purchased music wont play??

    my itunes plays most of the newly purchased music, but it wont play other music. i have already deathurized all computers and only authorized the one that im on now. but the older music says its still already used up all 5 slots. any thoughts???