Proc 10 call Oracle stored g with associative array from c# VS 2008

I have the following PL/SQL procedure:


CREATE OR REPLACE PROCEDURE HMA_ADM. PRC_VDM_SAVDEL_VEN_DOC

(

P_OP IN VARCHAR2,

P_USRID IN TB_VDM_MANAGE_DOCUMENTS. CREATEDBY % TYPE,

P_DATE IN VARCHAR2,--MUST BE STRING, OTHERWISE WE GET AN ERROR

P_DOCNAM IN TB_VDM_MANAGE_DOCUMENTS. DOCUMENTNAME % TYPE,

P_DOCLNK IN TB_VDM_MANAGE_DOCUMENTS. BUILDER % TYPE.

P_FNGUID IN TB_VDM_MANAGE_DOCUMENTS. FILENET_GUID % TYPE,

P_DESC IN TB_VDM_MANAGE_DOCUMENTS. DESCRIPTION % TYPE,

P_REQID IN VARR

) IS


Where VARR is:


CREATE OR REPLACE TYPE VARR'S ARRAY OF INTEGER;


In c#, I have the following code:

Int64 [] intReqID;



OracleCommand cmdVDL = new OracleCommand (DBQueries.SPQRY_SAVDELVENDOC, connDB);



cmdVDL.CommandType = CommandType.StoredProcedure;


cmdVDL.Parameters.Add (new OracleParameter ("P_OP", strop));

cmdVDL.Parameters.Add (new OracleParameter ("P_CREATEBY", strUID));

cmdVDL.Parameters.Add (new OracleParameter ("P_CREATEDATE", strDate));

cmdVDL.Parameters.Add (new OracleParameter ("P_DOCNAM", strDocNam));

cmdVDL.Parameters.Add (new OracleParameter ("P_DOCLNK", strURL));

cmdVDL.Parameters.Add (new OracleParameter ("P_FNGUID", strGUID));

cmdVDL.Parameters.Add (new OracleParameter ("P_DESC", strDesc));

cmdVDL.Parameters.Add (new OracleParameter ("P_REQID", OracleDbType.Int64) {}

CollectionType = OracleCollectionType.PLSQLAssociativeArray,

Size = intReqID.Count (),

Value = intReqID,

DbType = DbType.Int64,

OracleDbType = OracleDbType.Int64

});



[] OracleParameterStatus stat = new OracleParameterStatus [intReqID.Count ()];


for (i = 0; i < intReqID.Count (); i ++) {}

STAT [i] = OracleParameterStatus.Success;

}


"" "cmdVDL.Parameters ["P_REQID"]." ArrayBindStatus = stat;


cmdVDL.ExecuteNonQuery ();

When I run the present, I get the following error:

ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in the call to 'PRC_VDM_SAVDEL_VEN_DOC '.
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

If I remove the associative array at the same time, the procedure works very well.

What I am doing wrong?

In addition,

(1) support UDT requires ODP 11106.20 or later version (but can be used against db 10 g)
(2) if the plsql is editable, you can exchange to an associative array rather to avoid having to create classes customized for the UDT and here is a short example of soft.
Greg

/*
CREATE or replace PACKAGE MYPACK3 AS
TYPE numarray is table of number index by BINARY_INTEGER;
PROCEDURE getempsinarray(thearray IN numarray, numrecs out number);
END MYPACK3;
/
CREATE or replace PACKAGE BODY MYPACK3 AS
 PROCEDURE getempsinarray(thearray IN numarray, numrecs out number)
 IS
 begin
  numrecs :=  thearray.count;
 END getempsinarray;
END MYPACK3;
/
*/

using System;
using System.Data;
using Oracle.DataAccess.Client;

public class indexby
{
     public static void Main()
     {
      OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
      con.Open();
      OracleCommand cmd = new OracleCommand("mypack3.getempsinarray", con);
      cmd.CommandType = CommandType.StoredProcedure;

      OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Int32);
      Param1.Direction = ParameterDirection.Input;
      Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
      Param1.Value = new int[3]{7369,7499, 7521};
      Param1.Size = 3;

      OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output );

     cmd.ExecuteNonQuery();
     Console.WriteLine("{0} records passed in",Param2.Value);
      con.Close();
     }
}

Tags: Database

Similar Questions

  • How to call oracle stored procedure with hibernate

    Hi all
    I wrote the following stored procedure:

    create or replace
    PROCEDURE SP_GET_NUMBER (p_cursor sys_refcursor, departmentId in number, userId in number, documentTypeId number)
    as
    Enter the integer;
    sqlScript varchar2 (60);
    Start
    sqlScript: = "select registrationnumber_seq.nextval from dual;
    immediately run sqlScript in register;
    dbms_output.put_line ('Nextval is: ' |) To_char (Regid));
    insert into roketsanuser.registrationnumbers
    (id, departmentid, documenttypeid, number, registrationstatus, status, updatedate, updateuserid, version)
    values
    (enter it, null, null, enter it, 0, 0, sysdate, 0, 0);
    commit;
    Open the p_cursor for
    Select id
    roketsanuser.registrationnumbers® systems
    where reg.id = regid;
    end;

    And I define in the annotations in my entity class:

    @Entity (name = "Number")
    @Table (name = "REGISTRATIONNUMBERS")
    @SequenceGenerator (name = "REGISTRATIONNUMBER_SEQ", sequenceName = "REGISTRATIONNUMBER_SEQ")
    @org.hibernate.annotations.NamedNativeQuery (name = "SP_GET_NUMBER", query = "{call? "{= SP_GET_NUMBER (: departmentId,: userId,: documentTypeId)}"
    Callable = true, readOnly = true, resultClass = RegistrationNumber.class)
    @EntityListeners ({BaseEntityListener.class})
    Number/public class extends BaseEntity

    I call the query in my Dao class:

    public number getNumberForIncomingPaperworkByStoredProcedure (EntityManager Manager, number number)
    {
    A session = (Session) manager.getDelegate ();
    query org.hibernate.impl.SQLQueryImpl = (SQLQueryImpl) session.getNamedQuery ("SP_GET_NUMBER");

    query.setParameter ("departmentId", ObjectUtil.isNotNull (registrationNumber.getDepartment ())? registrationNumber.getDepartment () .getId (): "");
    query.setParameter ("userId", ObjectUtil.isNotNull (registrationNumber.getUser ())? registrationNumber.getUser () .getId (): "");
    query.setParameter ("documentTypeId", ObjectUtil.isNotNull (registrationNumber.getDocumentType ())? registrationNumber.getDocumentType () .getId (): "");
    Collection list = query.list ();
    return new RegistrationNumber();
    }

    But when I run the application exception occurred:
    < 01/02/2013 10:04:24 EET > < opinion > < Stdout > < BEA-000000 > < hibernation:
    / * name of SP_GET_NUMBER native SQL query * / {call? = SP_GET_NUMBER (?,?,?)} >
    < 01/02/2013 10:04:27 EET > < opinion > < Stdout > < BEA-000000 > < 10:04:27, 811 ERROR [IncomingPaperworkMBean] EJB Exception:; nested exception is:
    org.hibernate.exception.SQLGrammarException: could not execute the query. nested exception is: org.hibernate.exception.SQLGrammarException: could not execute the query >

    This is perhaps the reason why, please help me?

    Thanks in advance

    Message to research in syntax of:

    @org.hibernate.annotations.NamedNativeQuery

    It seems that following is a possible cause (but I'm not sure about this one):

    Query = "{call?" "{= SP_GET_NUMBER (: departmentId,: userId,: documentTypeId)} '.

    You can change this:

    Query = "(?)". (= appeler SP_GET_NUMBER (: departmentId,: userId,: documentTypeId)) "...

    or

    Query = "(call SP_GET_NUMBER (: departmentId,: userId,: documentTypeId)).

    and check if that helps...

    You can take a look at:

    https://Forum.Hibernate.org/viewtopic.php?p=2401604

    HTH,

    Bravo!
    AJ

  • How to call a stored procedure with a REF CURSOR output parameter

    I'm looking forward to example calling a function/stored procedure with a REF CURSOR output parameter and get the result.
    In other words, I have a stored function/procedure that runs a SELECT statement using the OCI library and then he could get the values of each row and each column.

    I put a code snippet, it have only the main thing to call a simple stored procedure and to print the name of each column of the cursor, but I couldn t to print out values in the table that calls the stored procedure.
    I understand that the next step is to call an OCIStmtFetch.
    How to associate the slider with the OCIStmtFetch?

    If you need more information, just tell me.

    I use ANSI C with HP - UX (HP - UX C) operating system and Oracle 10 g.


    Kind regards.

    Antonio Garcia


    / * callOracleSP * /.

    #include < stdio.h >
    #include < string.h >
    #include < oci.h >
    #include < stdlib.h > to

    char * pConnectChar = "Server";
    char * pUsernameChar = "user";
    char * pPasswordChar = "passwd";
    char * sqlCharArray1 = "BEGIN SP_GETCITIES (:,: 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 ("retval=%d\n",retval OCILogon);

    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 = 1 OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4), (void *) & state_key,)
    ((sb4) sizeof (state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
    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, OCI_DEFAULT (ub4));
    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, OCI_DEFAULT (ub4));
    printf ("StmtExecute retval=%d\n",retval);

    / * How to get the values of the cursor? */

    / * Number of parameters of the cursor * /.
    OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & parmcnt,(ub4 *) 0,)
    (ub4) (OCI_ATTR_PARAM_COUNT, pOciError);
    printf ("\nNumber of the slider settings = %d\n",parmcnt);

    for (int pos = 1; pos < = (int) parmcnt; pos ++)
    {
    OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & pos2,(ub4 *) 0,)
    (ub4) (OCI_ATTR_CURRENT_POSITION, pOciError);
    retval = OCIParamGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), pOciError, (void *) & pOciParam,)
    POS (ub4));
    OCIAttrGet pOciParam, (ub4) ((void*) 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 ("%i\tNAME = % column. ("* 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 ('NEW YORK', 10, 'NEW YORK')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('NEW YORK', 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 is specific global variables T/SQL. */
    TYPE RCT1 IS REF CURSOR; / * new cursor low definition * /.
    END globalPkg;
    /



    CREATE OR REPLACE PROCEDURE SP_ADDCITY)
    P_STATE_CODE IN VARCHAR,
    P_CITY_CODE NUMBER,
    P_CITY_NAME IN VARCHAR2,
    P_RETURN IN NUMBERS)
    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: = number of LINES SQL %;
    EXCEPTION
    WHEN TOO_MANY_ROWS THEN
    StoO_rowcnt: = 2;
    WHILE 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 FOR RC1
    SELECT STATE_CODE, CITY_CODE, FRANCISCO
    CITIES
    WHERE STATE_CODE = STATE_KEY
    ORDER BY CITY_CODE;
    StoO_rowcnt: = number of LINES SQL %;
    EXCEPTION
    WHILE OTHERS THEN
    StoO_rowcnt: = 0;
    StoO_error: = SQLCODE;
    StoO_errmsg: = SQLERRM;
    END;
    /

    Hi Antonio,.

    I see this:

    c_buf=(ub1 **)calloc(sizeof(ub1 *),3);
    
    ...
    
    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);
    

    That I don't understand. You allocate space for 3 pointers ub1 but I don't see where these pointers are then initialized to point to where the data is to be stored.

    I do not read correctly?

    Sorry for posting code long, but here is an example of code that I have. It is much more 'code' for your code, but maybe that will be enough...

    NOTE: This is just the code example and not rigorous. For example, I don't check the memory, allocations etc in this code!

    Kind regards

    Mark

    #ifdef WIN32
    #define _CRT_SECURE_NO_DEPRECATE 1
    #endif
    
    #include 
    #include 
    #include 
    #include 
    
    void checkerr(sword status, OCIError *errhp);
    
    int main(int argc, char *argv[]) {
      OCIEnv      *envhp = NULL;  /* OCI Environment handle     */
      OCIError    *errhp = NULL;  /* OCI Error handle           */
      OCISvcCtx   *svchp = NULL;  /* OCI Service Context handle */
      OCIServer   *srvhp = NULL;  /* OCI Server handle          */
      OCISession  *usrhp = NULL;  /* OCI User Session handle    */
    
      OCIStmt     *stmtp = NULL;  /* OCI Statement handle       */
      OCIStmt     *cursr = NULL;  /* OCI Statement handle       */
    
      OCIParam    *prmp1 = NULL;  /* OCI Parameter handle       */
      OCIParam    *prmp2 = NULL;  /* OCI Parameter handle       */
      OCIParam    *prmp3 = NULL;  /* OCI Parameter handle       */
    
      OCIDefine   *defp1 = NULL;  /* OCI Define handle          */
      OCIDefine   *defp2 = NULL;  /* OCI Define handle          */
      OCIDefine   *defp3 = NULL;  /* OCI Define handle          */
    
      OCIBind     *bndp1 = NULL;  /* OCI Bind handle            */
      OCIBind     *bndp2 = NULL;  /* OCI Bind handle            */
      OCIBind     *bndp3 = NULL;  /* OCI Bind handle            */
    
      /* used to hold column width */
      ub2 col_width;
    
      /* used to set the prefetch count */
      ub4 prefetch_count = 32;
    
      /* will hold output from database */
      oratext *pEmpId = NULL;
      oratext *pFirstName = NULL;
      oratext *pLastName = NULL;
    
      /* the anonymous block to execute */
      /* this opens a ref cursor        */
      oratext *sqlstmt = "begin " \
                         "  open :1 for " \
                         "  select   to_char(employee_id), " \
                         "           first_name, " \
                         "           last_name " \
                         "  from     hr.employees " \
                         "  order by last_name, " \
                         "           first_name; " \
                         "end;";
    
      /* used to hold the results of each OCI call */
      sword result = 0;
    
      /* Initialize and create a default environment  */
      result = OCIEnvCreate(&envhp,
                            OCI_DEFAULT,
                            (dvoid *) 0,
                            0,
                            0,
                            0,
                            (size_t) 0,
                            (dvoid **) 0);
    
      /* allocate an error handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &errhp,
                              OCI_HTYPE_ERROR,
                              0,
                              (dvoid **) 0);
    
      /* allocate a service context handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &svchp,
                              OCI_HTYPE_SVCCTX,
                              0,
                              (dvoid **) 0);
    
      /* allocate a server handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &srvhp,
                              OCI_HTYPE_SERVER,
                              0,
                              (dvoid **) 0);
    
      /* allocate a user session handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &usrhp,
                              OCI_HTYPE_SESSION,
                              0,
                              (dvoid **) 0);
    
      /* create a server context using the "ORADEMO" database */
      result = OCIServerAttach(srvhp,
                               errhp,
                               "ORADEMO",
                               (ub4) strlen("ORADEMO"),
                               OCI_DEFAULT);
    
      /* set the server attribute in the service context handle */
      result = OCIAttrSet((dvoid *) svchp,
                          OCI_HTYPE_SVCCTX,
                          (dvoid *) srvhp,
                          (ub4) 0,
                          OCI_ATTR_SERVER,
                          errhp);
    
      /* open the session with the database */
      /* using external authentication      */
      result = OCISessionBegin(svchp,
                               errhp,
                               usrhp,
                               OCI_CRED_EXT,
                               OCI_DEFAULT);
    
      /* set the user session attribute in the service context handle */
      result = OCIAttrSet((dvoid *) svchp,
                          OCI_HTYPE_SVCCTX,
                          (dvoid *) usrhp,
                          (ub4) 0,
                          OCI_ATTR_SESSION,
                          errhp);
    
      /* allocate the statement handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &stmtp,
                              OCI_HTYPE_STMT,
                              0,
                              (dvoid **) 0);
    
      /* prepare the statement for execution */
      result = OCIStmtPrepare(stmtp,
                              errhp,
                              sqlstmt,
                              (ub4) strlen((char *) sqlstmt),
                              OCI_NTV_SYNTAX,
                              OCI_DEFAULT);
    
      /* allocate the handle for the ref cursor */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (void **) &cursr,
                              OCI_HTYPE_STMT,
                              0,
                              NULL);
    
      /* bind the ref cursor parameter */
      result = OCIBindByPos(stmtp,
                            &bndp1,
                            errhp,
                            1,
                            &cursr,
                            0,
                            SQLT_RSET,
                            NULL,
                            0,
                            NULL,
                            0,
                            0,
                            OCI_DEFAULT);
    
      /* execute the statement */
      result = OCIStmtExecute(svchp,
                              stmtp,
                              errhp,
                              1,
                              0,
                              NULL,
                              NULL,
                              OCI_DEFAULT);  
    
      /* get parameter descriptor for first column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp1,
                           (ub4) 1);
    
      /* get parameter descriptor for second column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp2,
                           (ub4) 2);
    
      /* get parameter descriptor for third column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp3,
                           (ub4) 3);
    
      /* get the first column width in characters */
      result = OCIAttrGet((dvoid*) prmp1,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pEmpId = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the first column in the results */
      result = OCIDefineByPos(cursr,
                              &defp1,
                              errhp,
                              1,
                              (dvoid *) pEmpId,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* get the second column width in characters */
      result = OCIAttrGet((dvoid*) prmp2,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pFirstName = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the second column in the results */
      result = OCIDefineByPos(cursr,
                              &defp2,
                              errhp,
                              2,
                              (dvoid *) pFirstName,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* get the third column width in characters */
      result = OCIAttrGet((dvoid*) prmp3,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pLastName = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the third column in the results */
      result = OCIDefineByPos(cursr,
                              &defp3,
                              errhp,
                              3,
                              (dvoid *) pLastName,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* loop through and print the results */
      while ((result = OCIStmtFetch(cursr,
                                    errhp,
                                    (ub4) 1,
                                    (ub2) OCI_FETCH_NEXT,
                                    (ub4) OCI_DEFAULT)) == OCI_SUCCESS)
      {
        printf("Employee ID: %s\n", pEmpId);
        printf(" First Name: %s\n", pFirstName);
        printf("  Last Name: %s\n\n", pLastName);
      }
    
      /* free allocated memory */
      free(pEmpId);
      free(pFirstName);
      free(pLastName);
    
      pEmpId = NULL;
      pFirstName = NULL;
      pLastName = NULL;
    
      /* terminate the session with the database */
      result = OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT);
    
      /* detach from the server */
      result = OCIServerDetach(srvhp, errhp, OCI_DEFAULT);
    
      /* deallocate the environment handle     */
      /* OCI will deallocate the child handles */
      result = OCIHandleFree((dvoid *) envhp, OCI_HTYPE_ENV);
    
      return OCI_SUCCESS;
    }
    
    void checkerr(sword status, OCIError *errhp)
    {
      oratext errbuf[512];
      sb4 errcode = 0;
    
      switch (status) {
        case OCI_SUCCESS:
          break;
    
        case OCI_ERROR:
        case OCI_SUCCESS_WITH_INFO:
          (void) OCIErrorGet((dvoid *) errhp, (ub4) 1, (oratext *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
          (void) printf("Error: %.*s\n", sizeof(errbuf), errbuf);
          break;
    
        case OCI_NEED_DATA:
          (void) printf("Error - OCI_NEED_DATA\n");
          break;
    
        case OCI_NO_DATA:
          (void) printf("Error - OCI_NO_DATA\n");
          break;
    
        case OCI_INVALID_HANDLE:
          (void) printf("Error - OCI_INVALID_HANDLE\n");
          break;
    
        case OCI_STILL_EXECUTING:
          (void) printf("Error - OCI_STILL_EXECUTING\n");
          break;
    
        case OCI_CONTINUE:
          (void) printf("Error - OCI_CONTINUE\n");
          break;
    
        default:
          break;
      }
    }
    
  • means of a loop with associative arrays / objects: #1034: forced conversion

    I had a long post somewhere on here and just want to start a specific post on associative arrays just.

    First of all, I have a table which I do not know if it is an array, an associative array or an object, or both.

    That is to say: I read that below would be an object but works like a table also.

    The problem is when I use this table as references to instantiate classes in a runtime shared library.

    I seem to be able to create appropriate tables and objects, BUT I certainly can't use/acess them correctly. I have a massive confusion between movieclips and objects.

    I get an error of forced conversion when I try to add objects to a movieclip. just because I want to add the elements of mc to the scene.

    var definitionsArray:Array; 
    var bubblesArray:Array;
    var currentBubble:*;
    var correct:uint;
    var incorrect:uint;



    this.definitionsArray = new Array();
    this.definitionsArray.push({ sound:"AppleSound",mc:"Apple" });
    this.definitionsArray.push({ sound:"BananaSound",mc:"Banana" });
    this.definitionsArray.push({ sound:"BreadSound",mc:"Bread" });
    this.definitionsArray.push({ sound:"CakeSound",mc:"Cake"  });
    this.definitionsArray.push({ sound:"WaterSound",mc:"Water" });
    this.definitionsArray.push({ sound:"TomatoSound", mc:"Tomato" });
    this.definitionsArray.push({ sound:"SandwichSound",mc:"Sandwich" });
    this.definitionsArray.push({ sound:"PizzaSound",mc:"Pizza" });
    this.definitionsArray.push({ sound:"PearSound",mc:"Pear" });
    this.definitionsArray.push({ sound:"OrangeSound",mc:"Orange" });

    getData("library/food.swf", definitionsArray);

    function getData(libreria:String, matriz:Array)
    {
        this.definitionsArray = matriz;
        var context:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain);

        var loader:Loader = new Loader();
        var req:URLRequest = new URLRequest(libreria);

        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onAssetsLoaded);
        try
        {
            loader.load(req);
        }
        catch (e:Error)
        {
            trace("Asset load error: " + e);
        }
    }



    function onAssetsLoaded(e:Event):void
    {
        this.cartelArray = new Array();
        var loader:Loader = Loader(e.target.loader);

        this.libreria = loader.content;//this isn't used

        //var mezclaMAtriz:Array = this.definitionsArray.slice();
        bubblesArray = [];
        for (var i:uint = 0; i < this.definitionsArray.length; i++)
        {
            var libraryDomain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;
            var mcClass:Class = libraryDomain.getDefinition(definitionsArray[i].mc) as Class;
            var soundClass:Class = libraryDomain.getDefinition(definitionsArray[i].sound) as Class;

            var obj:Object = new Object();
            obj.mc = new mcClass();
            obj.sound = new soundClass();

            this.bubblesArray.push(obj);
            placeBubbles();
        }
    }

    function placeBubbles():void
    {
        var bubble:MovieClip;
        for (var i:int = 0; i < bubblesArray.length; i++)
        {
            bubble = bubblesArray[i];
            bubble.addEventListener(MouseEvent.CLICK, onBubbleClick);
            bubble.x = 100 + i * 150;
            bubble.y = 100;
            addChild(bubble);
        }
        // start game
        nextChoice();
    }

    If you set as an object, and then use this way...

    bubble var: Object;

  • C# Oracle.DataAccess calling a stored procedure with a date parameter throws formatexception

    C# Oracle.DataAccess CommandType.StoredProcedure is OracleDbType. Date

    I can't get my code to call an oracle procedure that has an order date.

    I receive a System.FormatException occurred in Oracle.DataAccess.dll

    I tried to assign the param. Value = DateTime and also tried assigning as a string formatted with no luck.

    What is the magic formula, I need to call this function?

    Here is a code snippet:

    OracleCommand cmd = new OracleCommand();

    cmd connection group appConn;.

    cmd.CommandText = "mypackage.myprocedure";

    cmd.CommandType = CommandType.StoredProcedure;

    Param = new OracleParameter ("iDateParamter", OracleDbType.Date, ParameterDirection.Input);

    Param. Value = "August 31, 2015."

    Here are other formats I' tried... ved param. Value = myDateValue.ToString ("dd - MMM-yyyy"). ToUpper(); (/ / "MM/dd/yyyy"); 'YYYY-MM-dd'); "MM-dd-yyyy");

    cmd. Parameters.Add (param);

                BindByName. cmd = true;

                cmd ExecuteNonQuery());

    Shame on me..., you can close this message

    It was not for the error on my date field, I had another parameter that has been attributed to a string instead of an integer.

    For the record, this has worked well for me:

    Param = new OracleParameter ("iActvyPerDate", OracleDbType.Date, ParameterDirection.Input);

    Param. Value = li. ActvyPerDate.ToString ("dd-MMM-yyyy"). ToUpper();

  • call a stored procedure with OUT VARCHAR2 parameter fails

    Hi all

    I use the Oracle 11.2.0.1 version OLE DB provider. I have a simple stored procedure that contains a VARCHAR2 OUT parameter:

    create or replace procedure TestOut (RESULT_CODE OUT VARCHAR2) is
    Start
    RESULT_CODE: = 'X '.
    TestOut end;

    The following c# code piece fails:

    String ConnStr = "Provider = OraOLEDB.Oracle; User ID = test; Password = test; Data Source = sandbox; « ;
    OleDbConnection Conn = new OleDbConnection (ConnStr);
    Conn.Open ();
    OleDbCommand Cmd new OleDbCommand();
    Cmd.Connection = Conn;
    OleDbParameter Param = Cmd.CreateParameter ();
    Param.ParameterName = "RESULT_CODE ';
    Param.Direction = System.Data.ParameterDirection.Output;
    Param.OleDbType = OleDbType.BSTR;
    Param.Size = 1;
    Cmd.Parameters.Add (Param);

    Cmd.CommandType = System.Data.CommandType.Text.
    Cmd.CommandText = "{TESTOUT (?). CALL} ";
    Cmd.ExecuteNonQuery ();

    If the stored procedure is modified to contain an OUT parameter, the same code works, after you change the type of parameter to appropriate OleDBType (OleDbType.SmallInt).

    What am I doing wrong when handling OUTPUT VARCHAR parameters? Y at - there any limitation on the types of parameters stored procedure using the Oracle OleDB provider?

    Published by: user957565 on 1/Ago/2011 06:31

    I get an access violation, using 11202. What do you get?

    In any case, it works fine for me using OleDbType.VarChar instead of OleDbType.BSTR.

    Hope this helps, comments welcome.

    Greg

  • Problems calling a stored procedure with DG4IFMX

    Hi guys,.

    I try to call stored procedures of database Informix, which is connected by an Oracle for Informix database gateway.

    I ran select, update, delete correctly but when I try to execute a stored procedure, that nothing is happening.

    for example:
    When I run
    call branko"@link_informix (1) «»

    It returns that it is performed successfully, without error, but as you can see below no entry is entered in the branko_test table

    to informix:

    drop the branko procedure;
    Create procedure "informix".branko (integer _vlez)
    returning a Boolean;
    If _vlez = 1 then
    insert into branko_test values ('uspesen test', '1');
    on the other
    insert into branko_test values ('test 2 ', 2' uspesen);

    end if;
    end of procedure;

    the procedure runs ok when called to informix.

    Thanks for any help

    P.S I even tried running:

    declare
    Whole RET;
    Start
    RET: = DBMS_HS_PASSTHROUGH. EXECUTE_IMMEDIATE@link_informix (' branko procedure (2)');
    end;

    but the same thing happens, no entry in the branko_test table.

    Find the root cause:
    When you are using dbaccess to call the original procedure it displays on the screen (expression)
    => remove the return value as it is not managed

    -> looks like not supported return Boolean value. Changes to the procedure of

    drop the branko procedure;
    Create procedure "informix".branko (integer _vlez)

    If _vlez = 1 then
    insert into branko_test values ('uspesen test', '1');
    on the other
    insert into branko_test values ('test 2 ', 2' uspesen);

    end if;
    end of procedure;

    allows me to execute the procedure using passthrough
    DECLARE
    result VARCHAR2 (50);
    BEGIN
    result: = DBMS_HS_PASSTHROUGH. EXECUTE_IMMEDIATE@dg4ifmx (' run the informix.branko procedure (1)');
    END;
    /

    Edited by: kgronau may 6, 2011 07:31

  • Create the stored procedure with the table from another throw diagram PLS-00201

    Oracle 10g. I'm new on procedures, so maybe I'm missing something obvious.

    The ABC schema owner has table T2001_WRITEOFF. The SYSDBAs given SIUD Some_Update_Role and granted this role to developer user IJK. IJK user then created a private synonym T2001_WRITEOFF for ABC. T2001_WRITEOFF. It worked with the usual SQL DML commands.

    When I try to create a simple procedure, it throws PLS-00201 identifier "T2001_WRITEOFF" must be declared and the points of the 2nd line.

    create or replace procedure woof1(
      fooname
    in T2001_WRITEOFF.territory%TYPE,  <=== error points here
      bardesc
    IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
    BEGIN
      
    INSERT into T2001_WRITEOFF
      
    VALUES ( fooname, bardesc);
    END woof1;
    /


    What I am doing wrong?


    Thank you

    JimR


    Grant the necessary rights directly to the user (not through a role):

    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551289900368934430

  • call the stored procedure in oracle toplink

    Hello
    I use jdev 10.1.3 toplink.
    call oracle stored procedure always failed ora-00900 invalid sql statement.

    Workaround I found is using below codes:
    String sql = "{RESETCURQTY (?). call} ";
    UOW UnitOfWork is getSessionFactory () .acquireUnitOfWork ();.
    uow.beginEarlyTransaction ();
    Conexion Connection = ((UnitOfWorkImpl) uow) .getAccessor () .getConnection ();
    CallableStatement call = null;
    try {}
    Call = conexion.prepareCall (sql);
    call.setString ("P_BRANCHCODE", branchCode);
    Call.Execute ();
    } catch (SQLException ex) {}
    ex.printStackTrace ();
    } {Finally
    {if(Call!=null)}
    try {}
    Call.Close ();
    }
    catch (SQLException e) {}
    e.printStackTrace ();
    }
    }
    }

    I found a few doc toplink on the use of StoredProcedureCall, none of it to success.
    / * A session = getSessionFactory () .acquireSession ();
    Call of StoredProcedureCall = new StoredProcedureCall();
    call.setProcedureName ("RESETCURQTY");
    call.addNamedArgumentValue ("P_BRANCHCODE", "TEST");
    Query ValueReadQuery = new ValueReadQuery();
    query.setCall (call);
    query.addArgument ("P_BRANCHCODE");

    Vector of parameters = new Vector();
    parameters.addElement (branchCode);
    session.executeQuery (query);

    TopLink support calls a stored procedure?

    Thank you
    Ricky

    Hello

    Looks like the database is to launch an exception because you run the query as a read request instead of as a non-selection call. Try to use a DataModifyQuery instead, or you can run the StoredProcedureCall directly using session.executeNonSelectingCall (call);

    Best regards
    Chris

  • Oracle stored procedure in the reports

    Hello

    How can I call oracle stored procedure in Oracle reports. The procedure takes a variable of type object and as a parameter out.

    Thank you
    Groult

    Create a package in your report and set a variable of this type of object in the package body.
    Write a procedure in your package that checks if your variable is empty, and if this is the case, call your db-procedure to fill the variable.
    For each value that you want to display in your report, create a functioncolumn that calls the formlery procedure written in your package and then returns the requested of your object type value. In the available build ontop the columns function created fields.

  • Associative arrays

    Quoting docs.oracle.com lines


    Associative arrays are used to represent sets of data of arbitrary size, with quick search of an individual element without its position in the table and without
    having to loop through all the elements in the array. Here is a small example

    DECLARE
    TYPE population_type IS TABLE OF NUMBER INDEX OF VARCHAR2 (64);
    country_population population_type;
    continent_population population_type;
    howmany NUMBER;
    that VARCHAR2 (64);
    BEGIN
    country_population ('Greenland'): = 100000; -Creates the entry
    country_population ('Iceland'): = 750000; -Creates the entry
    -Research associated with a value chain
    howmany: = country_population ('Greenland');
    continent_population ('Australia'): = 30000000;
    continent_population ('Antarctica'): = 1000; -Creates the entry
    continent_population ('Antarctica'): = 1001; -Replaces the previous value
    -Returns "Antarctic" which comes first in alphabetical order.
    who: = continent_population. FIRST;
    -Returns "Australia", which comes last in the alphabetical order.
    who: = continent_population. LAST;
    -Returns the value corresponding to the last key, in this
    -case of the Australia population.
    howmany: = continent_population (continent_population. LAST);
    END;
    /



    my doubt is in what regards the statement "with a quick search of an individual element without its position in the table".can someone give a small relevant example. Therefore the associative arrays is also appropriate for relatively small lookup tables where the collection can be constructed in memory eachtime, a procedure is called? Thanks in advance...

    >
    my doubt is in what regards the statement "with a quick search of an individual element without its position in the table".can someone give a small relevant example.
    >
    Think of it as gradually close equivalent to a hash of key/value pairs. When you want to insert an item provide you the key, Oracle axe key to find the entry in the hash table. It doesn't matter if the entry is the first, last, or any other arbitrary position in the table.
    >
    Therefore the associative arrays is also appropriate for relatively small lookup tables where the collection can be constructed in memory eachtime, a procedure is called?
    >
    The scope of the variables of the procedure is only the duration of the procedure. They are built when the procedure is called and destroyed when the procedure ends.

    If any associative array created in the procedure must be small to minimize the impact on the performance of the table fill. If the procedure performs complex calculations or ETL one record at a time, it is more efficient to get a value from the array instead of having to re - query a database table for him.

    For example, for the United States, a list of 50 State and their full name abbreviations that can be stored in an associative array and procedure could extract the code of the State of a data element, and quickly find the name of the State of the table. It would be faster than executing a query on the database on a lookup table.

  • Check if a value is in an associative array?

    Hello
    I am writing a process to plug into an existing infrastructure. I have an associative array of data (that I can't change the definition of) which is defined as:
    type vc_arr2 is table of the varchar2 (32767) index directory.

    An example of a data set can be:
    Key   Text
    1 => Apple
    2 => Banana
    3 => Pear
    4 => Plum
    5 => Grape
    etc etc
    Now I need to be able to see information indicating if a specific text value appears in the values, that is to say "is"Bananas"in the table? Now of course I could do it by writing a procedure loop over all the elements in order but there at - it do something built that? There are the obvious overhead (potentially) to loop through each element for each item, I'm looking for - I hope that there is something built in which more effective (IE, 'index' values or something like that).
    As far as I know, ARRAY. Exists() works on the key and not the value, and MEMBER OF cannot be used with associative arrays.
    I'm not interested in what the key is for a given value (and I realize, it may be more than one key mapping to a given value), all I want is just if the element exists in the table.

    Any help or suggestions would be greatly appreciated!

    No, you will need to loop through each of them, as your index finger is not on the text.

    No reason to use an associative array in the first place? Why not use database and SQL tables? Oracle is good at those. ;)

  • Java - a stored procedure with call by result

    Hi the Oracle community,

    I'm looking for some example Code how to use a Java-Stored procedure with output parameters. Don't get me wrong. I don't want to call a procedure with the parameters Out of Java (there are many examples in this respect over there). I want to just implement the appeal of the concept of results in a Java-Stored procedure. A customer calls this procedure with certain parameters and the Java procedure will fill the. So my first question: is it possible? And my second Question: how to implement it?

    Greetings.

    I found a solution. It's very simple.

    Just setting the parameters as java array (e.g., String() P1). The first value (P1 [0]) is the returned value.

    Finally just contained JDeveloper in dialog box "Edit method Signature" the parametermode OUT.

    The dialog box are entitled on the stored procedure in the dbexport file. You can read this

    in Section 6, publishing Java Classes with call specifications-> defining the Modes parameter in

    The Oracle database Java Developer's Guide.

  • JPA with Oracle stored procedure: setting IN or OUT to missing index: 1

    Hello

    I'm going to have bad configure integration between Oracle stored procedure (which returns a cursor) and the Parliamentary Assembly joint.



    Stored procedure
    CREATE OR REPLACE PROCEDURE GET_ACCOUNTS_TEST
    (
    l_cursor on sys_refcursor
    )
    AS
    BEGIN
    L_cursor OPEN for SELECT * FROM ACCOUNTS_TEST ORDER OF ACCOUNT_NAME.
    END GET_ACCOUNTS_TEST;



    Oracle bean
    @Entity
    @NamedNativeQueries({)
    @NamedNativeQuery (name = "getAccountsSP", query = "{GET_ACCOUNTS_TEST (?) call} "(, resultClass = Account.class)"
    })
    @Table (name = "ACCOUNTS_TEST")
    Account/public class implements Serializable {}
    .....
    }



    ManagedAccountBean
    public Collection < account > getAccountsSP() {}

    EntityManager em = jpaResourceBean.getEMF () .createEntityManager ();

    try {}
    Query query = em.createNamedQuery ("getAccountsSP");
    (Collection < account >) return query.getResultList ();
    } {Finally
    EM. Close();
    }
    }



    Get this error
    Exception [EclipseLink-4002] (Eclipse - 2.4.0.v20120608 persistence Services - r11652): org.eclipse.persistence.exceptions.DatabaseException
    Inner exception: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in the call to 'GET_ACCOUNTS_TEST '.
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    Error code: 6550
    Call: {call GET_ACCOUNTS_TEST (?)}
    link = > [null]
    Query: ReadAllQuery (name = "getAccountsSP" referenceClass = sql = "{call GET_ACCOUNTS_TEST (?)}" account)




    Any ideas? I can get the code to use a query in the code, but not via. an AP

    Thank you

    The exception occurs because you said JPA to pass a parameter, but it is not expected the stored procedure. Try to change your definition of stored proc in a cursor output variable that can be used in your JPA query to return the cursor. An example is here:
    http://wiki.Eclipse.org/EclipseLink/examples/JPA/StoredProcedures

    Best regards
    Chris

  • Calling stored procedure with an input of DATE parameter

    Hello. A question about the Date input parameters when you call a stored procedure.

    I have a procedure that takes a DATE as input parameter. I would DATE this value to include a time element.

    My Application Module method takes an input as a java.util.Date (myParamDate) parameter - that will preserve a time element (?).

    However when I create the CallableStatement, I am trying to set the parameter using setDate like this (for the param 5):
                st = getDBTransaction().createCallableStatement("begin cs_my_pck.request_values(?,?,?,?,?,?,?,?); end;", 0);            
                Connection myConn = st.getConnection();
                ArrayDescriptor myArrDesc  =  ArrayDescriptor.createDescriptor("CS_FIELD_TABT", myConn);
                Array sqlParamNameArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramNames.toArray());
                Array sqlParamValueArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramValues.toArray());
                Array sqlFilterNameArray = new oracle.sql.ARRAY(myArrDesc,myConn,filterNames.toArray());
                    
                st.setString(1, repType);
                st.setObject(2, sqlParamNameArray);
                st.setObject(3,sqlParamValueArray);
                st.setObject(4,sqlFilterNameArray);
    
                java.sql.Date myRepDate = new java.sql.Date(myParamDate.getTime());
    
                st.setDate(5,myRepDate);
                
                System.out.println("Report Date = " + myRepDate.toString());
                st.setString(6,repUser);
                st.setString(7,repAttach);
                // set out param
                st.registerOutParameter(8, Types.NUMERIC);
                st.execute();
    I understand java.sql.Date does NOT include a time element. But setDate() only accepts a java.sql.Date so my parameter of the procedure ends with a zero time element.

    How to call this procedure keeping the time element?

    Thank you.

    It includes the time element, if you want more precision with time stamp.

    http://docs.Oracle.com/javase/6/docs/API/Java/SQL/date.html

Maybe you are looking for