Trouble while passing an array as a parameter to an JDBC Control

Hi everyone, recently I have upgraded my WLS Workshop 8.1 application to WLS 10gR3 using the workshop 8.1 application upgrade but after the upgrade to beehive controls I'm having troubles in a couple of methods that receive an array as a parameter. One of the methods is the following:
* @jc:sql array-max-length="all" max-rows="all"
* statement::
* select COUNT(*) FROM (
* SELECT la.lea_gkey,la.eme_gkey
* FROM (SELECT gkey, name, role FROM employees WHERE {sql:fn in(gkey,{emeGkeyArray})}) e,
* lead_assignees la,
* leads le,
* cities ct,
* (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TARGET') targets,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100
* WHERE e.gkey = la.eme_gkey
* AND la.lea_gkey = le.gkey
* AND le.city = ct.gkey(+)
* AND le.gkey = cn.lea_gkey(+)
* AND le.gkey = targets.lea_gkey(+)
* AND le.gkey = top5.lea_gkey(+)
* AND le.gkey = top100.lea_gkey(+)
* {sql: whereClause}
* UNION
* SELECT DISTINCT la.lea_gkey,la.eme_gkey
* FROM (SELECT gkey, name, role FROM employees WHERE {sql:fn in(gkey,{emeGkeyArray})}) e,
* lead_assignees la,
* shared_accounts sa,
* leads le,
* cities ct,
* employees asign,
* (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TARGET') targets,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100
* WHERE e.gkey = sa.eme_gkey
* AND asign.gkey = la.eme_gkey
* AND asign.active='X'
* AND sa.lea_gkey = le.gkey
* AND sa.lea_gkey = la.lea_gkey
* AND le.city = ct.gkey(+)
* AND le.gkey = cn.lea_gkey(+)
* AND le.gkey = targets.lea_gkey(+)
* AND le.gkey = top5.lea_gkey(+)
* AND le.gkey = top100.lea_gkey(+)
* {sql: assigneeClause}
* UNION
* SELECT DISTINCT la.lea_gkey,la.eme_gkey
* FROM (SELECT gkey, name, role FROM employees WHERE {sql:fn in(gkey,{emeGkeyArray})}) e,
* lead_assignees la,
* shared_accounts sa,
* leads le,
* cities ct,
* (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TARGET') targets,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5,
* (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100
* WHERE e.gkey = la.eme_gkey
* AND sa.lea_gkey = le.gkey
* AND sa.lea_gkey = la.lea_gkey
* AND le.city = ct.gkey(+)
* AND le.gkey = cn.lea_gkey(+)
* AND le.gkey = targets.lea_gkey(+)
* AND le.gkey = top5.lea_gkey(+)
* AND le.gkey = top100.lea_gkey(+)
* {sql: sharedClause})::
@JdbcControl.SQL(arrayMaxLength = 0,
maxRows = JdbcControl.MAXROWS_ALL,
statement = "select COUNT(*) FROM ( SELECT la.lea_gkey,la.eme_gkey FROM (SELECT gkey, name, role FROM employees WHERE {sql:fn in(gkey,{emeGkeyArray})}) e, lead_assignees la, leads le, cities ct, (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TARGET') targets, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100 WHERE e.gkey = la.eme_gkey AND la.lea_gkey = le.gkey AND le.city = ct.gkey(+) AND le.gkey = cn.lea_gkey(+) AND le.gkey = targets.lea_gkey(+) AND le.gkey = top5.lea_gkey(+) AND le.gkey = top100.lea_gkey(+) {sql: whereClause} UNION SELECT DISTINCT la.lea_gkey,la.eme_gkey FROM (SELECT gkey, name, role FROM employees WHERE {sql:fn in(gkey,{emeGkeyArray})}) e, lead_assignees la, shared_accounts sa, leads le, cities ct, employees asign, (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TARGET') targets, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100 WHERE e.gkey = sa.eme_gkey AND asign.gkey = la.eme_gkey AND asign.active='X' AND sa.lea_gkey = le.gkey AND sa.lea_gkey = la.lea_gkey AND le.city = ct.gkey(+) AND le.gkey = cn.lea_gkey(+) AND le.gkey = targets.lea_gkey(+) AND le.gkey = top5.lea_gkey(+) AND le.gkey = top100.lea_gkey(+) {sql: assigneeClause} UNION SELECT DISTINCT la.lea_gkey,la.eme_gkey FROM (SELECT gkey, name, role FROM employees WHERE {sql:fn in(gkey,{emeGkeyArray})}) e, lead_assignees la, shared_accounts sa, leads le, cities ct, (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TARGET') targets, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100 WHERE e.gkey = la.eme_gkey AND sa.lea_gkey = le.gkey AND sa.lea_gkey = la.lea_gkey AND le.city = ct.gkey(+) AND le.gkey = cn.lea_gkey(+) AND le.gkey = targets.lea_gkey(+) AND le.gkey = top5.lea_gkey(+) AND le.gkey = top100.lea_gkey(+) {sql: sharedClause})")
public Long getProspectsCount(String[] emeGkeyArray, String whereClause, String assigneeClause, String sharedClause) throws SQLException;
The execution of the method is the following:
pendingApprovals = leadsListingDB.getProspectsCount(employeeHierarchyArray, pendingApprovalsClause, pendingApprovalsClause, pendingApprovalsClause);
When the method is executed all the String parameters (whereClause, assigneeClause & sharedClause) are replaced well except the array parameter (emeGkeyArray) so the execution throws the following exception because the array is not replaced:
<Jan 20, 2010 1:01:26 PM CST> <Debug> <org.apache.beehive.controls.system.jdbc.JdbcControlImpl> <BEA-000000> <Enter: onAquire()>
<Jan 20, 2010 1:01:26 PM CST> <Debug> <org.apache.beehive.controls.system.jdbc.JdbcControlImpl> <BEA-000000> <Enter: invoke()>
<Jan 20, 2010 1:01:26 PM CST> <Info> <org.apache.beehive.controls.system.jdbc.JdbcControlImpl> <BEA-000000> <PreparedStatement: select COUNT(*) FROM ( SELECT la.lea_gkey,la.eme_gkey FROM (SELECT gkey, n
me, role FROM employees WHERE (gkey IN ())) e, lead_assignees la, leads le, cities ct, (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn, (SELECT lea_gkey, tag FROM lead
tags WHERE tag = 'TARGET') targets, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100 WHERE e.gkey = la.eme_gkey AND la.l
a_gkey = le.gkey AND le.city = ct.gkey(+) AND le.gkey = cn.lea_gkey(+) AND le.gkey = targets.lea_gkey(+) AND le.gkey = top5.lea_gkey(+) AND le.gkey = top100.lea_gkey(+) AND LA.ACTIVE = 'X' AND LE.WE
KLY_POTENTIAL > 0 AND (LE.APPROVED IS NULL OR LE.APPROVED != 'Y') AND LA.SALE_STAGE IN(3034,3005) UNION SELECT DISTINCT la.lea_gkey,la.eme_gkey FROM (SELECT gkey, name, role FROM employees WHERE (gkey I
())) e, lead_assignees la, shared_accounts sa, leads le, cities ct, employees asign, (select lea_gkey,name,email,phone,title from contacts where principal = 'X') cn, (SELECT lea_gkey, tag FROM lea
tags WHERE tag = 'TARGET') targets,  (SELECT leagkey, tag FROM lead_tags WHERE tag = 'TOP5') top5, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP100') top100 WHERE e.gkey = sa.eme_gkey AND asi
n.gkey = la.eme_gkey AND asign.active='X' AND sa.lea_gkey = le.gkey AND sa.lea_gkey = la.lea_gkey AND le.city = ct.gkey(+) AND le.gkey = cn.lea_gkey(+) AND le.gkey = targets.lea_gkey(+) AND le.gkey
= top5.lea_gkey(+) AND le.gkey = top100.lea_gkey(+) AND LA.ACTIVE = 'X' AND LE.WEEKLY_POTENTIAL > 0 AND (LE.APPROVED IS NULL OR LE.APPROVED != 'Y') AND LA.SALE_STAGE IN(3034,3005) UNION SELECT DISTINCT
la.lea_gkey,la.eme_gkey FROM (SELECT gkey, name, role FROM employees WHERE (gkey IN ())) e, lead_assignees la, shared_accounts sa, leads le, cities ct, (select lea_gkey,name,email,phone,title from c
ntacts where principal = 'X') cn, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TARGET') targets, (SELECT lea_gkey, tag FROM lead_tags WHERE tag = 'TOP5') top5, (SELECT lea_gkey, tag FROM lead_tags
WHERE tag = 'TOP100') top100 WHERE e.gkey = la.eme_gkey AND sa.lea_gkey = le.gkey AND sa.lea_gkey = la.lea_gkey AND le.city = ct.gkey(+) AND le.gkey = cn.lea_gkey(+) AND le.gkey = targets.lea_gkey(+
AND le.gkey = top5.lea_gkey(+) AND le.gkey = top100.lea_gkey(+) AND LA.ACTIVE = 'X' AND LE.WEEKLY_POTENTIAL > 0 AND (LE.APPROVED IS NULL OR LE.APPROVED != 'Y') AND LA.SALE_STAGE IN(3034,3005)) Params:
{}>
<Jan 20, 2010 1:01:26 PM CST> <Debug> <org.apache.beehive.netui.pageflow.FlowController> <BEA-000000> <Invoking exception handler method handleException(java.lang.Exception, ...)>
[LeadsMailer] Unhandled exception caught in Global.app:
java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
So the big question is if that behavior is due to a bug of I'm doing something wrong. Do someone can give me an advice about this problem because the array parameter has no problems in workshop 8.1?
Thanks in advance!

Greetings
I may not have an answer for you, but i am in the same boat! I am trying to pass an array to store in the database. I have 2 out of 8 columns that need to be stored as arrays. Everything saves EXEPT for the 2 arrays in question. I am using BEEHIVE with my web app. The strange thing is that i do not receive any syntax errors or runtime codes. I am still searching for an answer. If i find anything out, i will let you know.
John Miller
[email protected]

Similar Messages

  • Passing an array as IN parameter to call a function

    I have a function the definition is
    TYPE VAR_VALUE_RECORD IS RECORD(VAR VARCHAR2(100),
                   VALUE VARCHAR2(100));
    TYPE VAR_VALUE_TAB IS TABLE OF VAR_VALUE_RECORD;
    FUNCTION GENERIC_WF(P_MSG_TYPE IN VARCHAR2,P_CDCS_NBR IN VARCHAR2, P_CDCS_SEQ IN VARCHAR2, P_DEBTORID IN NUMBER,
    P_EXTRAS IN VAR_VALUE_TAB) RETURN VARCHAR2;
    I am trying to call this function
    select WF_NOTIFICATIONS_PKG.GENERIC_WF('Manual Debt Establish Notification','2009A13636','001',105195359,'this is a test') from dual
    ERROR at line 1:
    ORA-06553: PLS-306: wrong number or types of arguments in call to 'GENERIC_WF'
    I am getting the above error, how do I pass the array as parameter.
    I will appreciate your help.
    Thnaks

    Hi,
    try this,
    Create OR Replace Package WF_NOTIFICATIONS_PKG Is
       Type VAR_VALUE_RECORD Is Record( VAR   Varchar2(100)
                                      , Value Varchar2(100));
       Type VAR_VALUE_TAB Is Table Of VAR_VALUE_RECORD Index BY Pls_Integer;
       Function GENERIC_WF( P_MSG_TYPE IN Varchar2
                          , P_CDCS_NBR IN Varchar2
                          , P_CDCS_SEQ IN Varchar2
                          , P_DEBTORID IN Number
                          , P_EXTRAS   IN VAR_VALUE_TAB ) Return Varchar2;
    End WF_NOTIFICATIONS_PKG;
    Create OR Replace Package Body WF_NOTIFICATIONS_PKG Is
       Function GENERIC_WF( P_MSG_TYPE IN Varchar2
                          , P_CDCS_NBR IN Varchar2
                          , P_CDCS_SEQ IN Varchar2
                          , P_DEBTORID IN Number
                          , P_EXTRAS   IN VAR_VALUE_TAB ) Return Varchar2 Is
       Begin
          Return ( P_EXTRAS(P_EXTRAS.First).var || ' - ' || P_EXTRAS(P_EXTRAS.First).Value );
       End GENERIC_WF;
    End WF_NOTIFICATIONS_PKG;
    SQL> Declare
      2     v_value_Tab WF_NOTIFICATIONS_PKG.VAR_VALUE_TAB;
      3     v_return    Varchar2(100);
      4  Begin
      5     v_value_Tab(1).var   := 'this is a test 1';
      6     v_value_Tab(1).value := 'this is a test 2';
      7 
      8     v_return := WF_NOTIFICATIONS_PKG.GENERIC_WF( 'Manual Debt Establish Notification'
      9                                                , '2009A13636'
    10                                                , '001'
    11                                                , 105195359
    12                                                , v_value_Tab );
    13 
    14     Dbms_Output.put_line(v_return);
    15  End;
    16  /
    this is a test 1 - this is a test 2
    PL/SQL procedure successfully completedRegards,
    Christian Balz

  • Question?? - passing 2D array as a parameter of a stored procedure

    Hi,
    I have been having a lot of trouble with executing a stored procedure. I'm hoping someone can help me with this:
    THe stored proc. has 10 parameters, 5 IN and 5 OUT. One of these parameters coming out is a 2D array, however I"m not sure how I would be able to call the correct OCCI type coming out.
    I've declared a 2D array char sample[10][10];
    and then:
    stmt - > registerOutParam ( 7, oracle::occi:OCCI*???, sizeof(sample);
    and then :
    char outarray[10][10];
    out_array = stmt -> getString??? get*??
    I tried just passing a string itself, but as the procedure is looking for a 2D array, the program aborts, but I'm really not sure how I can solve this...??
    I'm kind of new to this subject, and I would really appreciate any help anyone can provide, with being able to pass in a 2D char array and being able to receive the outcomning data.
    Thanks a lot for any help!

    Hi,
    thank you for the link, it helped a lot....
    my C++ app that calls my stored procedure does compile, however, when I execute it "Aborts". I debugged it and found that right before my
    stmt->executeUpdate()
    statement, it outputs "Aborts", I'm really not sure why this is aborting, are there any specific debug statements or anything I can use specific to occi so that I can trace why my program aborts right before the executeUpdate statement (also I have checked my procedure and it is compiled and valid, and all my parameter types are correct).
    Does anyone have any ideas??
    Any help on this matter is really appreciated... thank you

  • Passing an array as parameter from java (java controls) to stored procedure

    Hi,
    I'm using java controls (BEA Weblogic Workshop 8.1) to call a stored procedure and send an array as a parameter to the stored procedure from java. The following code below throws an exception "Fail to convert to internal representation".
    Java code
    import com.bea.control.DatabaseControl.SQLParameter;
    // Here i create the java array
    int[] javaArray={12,13,14};
    //The code below is used to create the oracle sql array for the procedure
    SQLParameter[] params = new SQLParameter[1];
    Object obj0=javaArray;
    params[0] = new SQLParameter(obj0, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN);
    // the code below calls the testFunc method in OJDBCtrl.jcx file
    String succ= dbControl.testFunc(params);
    OJDBCtrl.jcx
    * @jc:sql statement="call CMNT_TST_PROC(?))"
    String testFunc(SQLParameter[] param);
    The stored procedure used:
    TYPE SL_tab IS TABLE OF number INDEX BY PLS_INTEGER;
    Procedure cmnt_tst_proc (cmnt_tst sl_tab);
    Procedure cmnt_tst_proc (cmnt_tst sl_tab) is
    BEGIN
    dbms_output.put_line('Hello');
    END;
    I am getting the following exception
    Failure=java.sql.SQLException: Fail to convert to internal representation: [I@438af4 [ServiceException]>
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
    at oracle.sql.ARRAY.toARRAY(ARRAY.java:210)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7768)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7449)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7837)
    at oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4587)
    at weblogic.jdbc.wrapper.PreparedStatement.setObject(PreparedStatement.java:244)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl._setParameter(DatabaseControlImpl.jcs:1886)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.getStatement_v2(DatabaseControlImpl.jcs:1732)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.invoke(DatabaseControlImpl.jcs:2591)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:249)
    at com.bea.wlw.runtime.jcs.container.JcsContainer.invoke(JcsContainer.java:85)
    at com.bea.wlw.runtime.core.bean.BaseContainerBean.invokeBase(BaseContainerBean.java:224)
    at com.bea.wlw.runtime.core.bean.SLSBContainerBean.invoke(SLSBContainerBean.java:109)
    at com.bea.wlwgen.StatelessContainer_ly05hg_ELOImpl.invoke(StatelessContainer_ly05hg_ELOImpl.java:153)
    Can you please let me know, what i'm doing wrong and how i can pass an array to a procedure/function using java controls.
    Any help will be highly appreciated.
    Edited by: user12671762 on Feb 24, 2010 5:03 AM
    Edited by: user9211663 on Feb 24, 2010 9:04 PM

    Thanks Michael.
    Here's the final code that i used, this might be helpful for those who face this problem
    Java Code
    // Following code gets the connection object
    InitialContext ctx = new InitialContext();
    dataSource = (DataSource)ctx.lookup("<DataSourceName>");
    conn=dataSource.getConnection();
    // Following code is used to create the array type from java
    String query="CREATE OR REPLACE TYPE STR_ARRAY AS VARRAY(3) OF NUMBER";
    dbControl.runTypeQuery(query);
    // Following code is used to obtain the oracle sql array as SQLParameter
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor("<schemaName>.STR_ARRAY", conn);
    Object[] elements = new Object[3];
    elements[0] = new Integer(12);
    elements[1] = new Integer(13);
    elements[2] = new Integer(14);
    oracle.sql.ARRAY newArray = new oracle.sql.ARRAY( desc, conn, elements);
    SQLParameter[] params = new SQLParameter[1];
    params[0] = new SQLParameter(newArray, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN);
    String succ= dbControl.testFunc(params);

  • Passing an array of objects to a named query

    I'm trying to use a named query that will have a
    in() expression operator (clause) to retrieve a set of objects.
    The in() operator requires an array of objects to pass in.
    Specifically I want to pass an array of BigDecimal of unknown size.
    The query looks like that:
    ExpressionBuilder seq = new ExpressionBuilder();
    Expression exp = seq.get("id").in(keys);
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(RegistrationNumberSequencer.class);
    query.addArgument("keys");
    query.setSelectionCriteria(exp);
    And the "keys" would be:
    Object[] keys = new Object[2];
    keys[0]= new BigDecimal(1);
    keys[1]= new BigDecimal(2);
    I have got a conversion exception(Could not convert to BigDecimal class) when executing the query.
    Can I pass this array as a parameter somehow ?
    Thanks a lot
    Ovidiu

    Hi Ovidiu,
    My apologies for the missed code. You need to pass the vector of elements into another vector, so TopLink will interpret the single element of the second vector as the correct query argument, and expend the elements in the first vector into the IN clause.
    The named query defined I sent in previous mail is still correct, but you need to pass in the argument like:
    Vector keys = new Vector();
    keys.addElement(new BigDecimal(1));
    keys.addElement(new BigDecimal(2));
    Vector arg = new Vector(1);
    arg.addElement(keys);
    Now you can pass the arg in when executing the query, and should get the correct result.
    To stand my claim, I did a mini test using our TopLink Employee demo and here is the generated SQL:
    Call:SELECT t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.START_TIME, t0.END_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE ((t0.EMP_ID IN (1, 2)) AND (t1.EMP_ID = t0.EMP_ID))
    You can see the IN clause in generated as expected!
    As Doug said, we do not officially support array as query argument yet. I would use the proper way to build the query.
    King

  • How can I pass an empty array to a parameter of type PLSQLAssociativeArray

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

  • Is possible to pass array/list as parameter in TopLink StoredProcedureCall?

    Hi, We need to pass an array/List/Vector of values (each value is a 10 character string) into TopLink's StoredProcedureCall. The maximum number of elements on the list is 3,000 (3,000 * 10 = 30,000 characters).
    This exposed two questions:
    1. Is it possible to pass a Vector as a parameter in TopLink's StoredProcedureCall, such as
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    Vector strVect = new Vector(3000);
    strVect.add(“ab-gthhjko”);
    strVect.add(“cd-gthhjko”);
    strVect.add(“ef-gthhjko”);
    Vector parameters = new Vector();
    parameters.addElement(strVect);
    session.executeQuery(query,parameters);
    2. If the answer on previous question is yes:
    - How this parameter has to be defined in Oracle’s Stored Procedure?
    - What is the maximum number of elements/bytes that can be passed into the vector?
    The best way that we have found so far was to use single string as a parameter. The individual values would be delimited by comma, such as "ab-gthhjko,cd-gthhjko,ef-gthhjko..."
    However, in this case concern is the size that can be 3,000 * 11 = 33, 000 characters. The maximum size of VARCHAR2 is 4000, so we would need to break calls in chunks (max 9 chunks).
    Is there any other/more optimal way to do this?
    Thanks for your help!
    Zoran

    Hello,
    No, you cannot currently pass a vector of objects as a parameter to a stored procedure. JDBC will not take a vector as an argument unless you want it to serialize it (ie a blob) .
    The Oracle database though does have support for struct types and varray types. So you could define a stored procedure to take a VARRAY of strings/varchar, and use that stored procedure through TopLink. For instance:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("STORED_PROCEDURE_NAME");
    call.addNamedArgument("PERSON_CODE");
    oracle.sql.ArrayDescriptor descriptor = new oracle.sql.ArrayDescriptor("ARRAYTYPE_NAME", dbconnection);
    oracle.sql.ARRAY dbarray = new oracle.sql.ARRAY(descriptor, dbconnection, dataArray);
    Vector parameters = new Vector();
    parameters.addElement(dbarray);
    session.executeQuery(query,parameters);This will work for any values as long as you are not going to pass in null as a value as the driver can determine the type from the object.
    dataArray is an Object array consisting of your String objects.
    For output or inoutput parameters you need to set the type and typename as well:
      sqlcall.addUnamedInOutputArgument("PERSON_CODE", "PERSON_CODE", Types.ARRAY, "ARRAYTYPE_NAME"); which will take a VARRAY and return a VARRAY type object.
    The next major release of TopLink will support taking in a vector of strings and performing the conversion to a VARRAY for you, as well as returning a vector instead of a VARRAY for out arguments.
    Check out thread
    Using VARRAYs as parameters to a Stored Procedure
    showing an example on how to get the conection to create the varray, as well as
    http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/varray/index.html on using Varrays in Oracle, though I'm sure the database docs might have more information.
    Best Regards,
    Chris

  • Error while passing parameter in Oracle Jdeveloper

    Hi All,
    I was passed Crystal report viewer object  From Servlet it is Running fine but one problem in that while passing parameter from that page  to data base it is not supporting (The ok Button on page).
    can any one tell me how to find Action Button (.Jsp page)
    Because i am using .jsp  page That was made in CR4E
    in that i found only jsp code I have not get how to work Action of that button
    Also another problem while making Viewer.jsp pge ..rpt-Crystal reports--->>Create Viewer Jsp->>Insert CrysatlReport viewer API code------->>>1.Connectparameterinthat report 2.connect the crystalreportPageViewer  while makin this page  i was running on Apache tomcat Server it is not displaying Anything only Displaying Blank Browser
    Can Any one help me...
    Sincerly
    Amol

    For your first question can you please be a little more clear as to what you are referring to?  I am not familiar with an action button for the parameter pages.... what I can tell you is that we don't have any jsp code for the viewer controls, all of that is generated dynamically at runtime.  We do have a viewer SDK that you can use to set properties on the viewer; information about this can be found in the [Developer Library|https://boc.sdn.sap.com/developer/library] in the Viewer SDK documentation book.
    For your second question, I assume you are referring to generating a viewer page from a report in Crystal Reports for Eclipse.  You will need to uncomment the viewer code (for some reason when the page is generated, the viewer code has block comments surrounding it).  You will probably want to make sure the parameter code is uncommented as well. 
    In addition to this, there is a helper file called JRCHelperSample.java that contains all of the helper methods for the automatically generated viewer page.  This can be modified in whatever way you wish to suit your needs.

  • Getting Type Mismatch Error while passing Array of Interfaces from C#(VSTO) to VBA through IDispatch interface

    Hi,
    I am facing issues like Type Mismatch while passing Array of interfaces from .NET  to VBA and vice versa using VSTO technology.
    My requirement is that ComInterfaceType needs to be InterfaceIsIDispatch.
    My Interface definition is somewhat like this
        [ComVisible(true)]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        [Guid("AAF48FBC-52B6-4179-A8D2-944D7FBF264E")]
        public interface IInterface1
            [DispId(0)]
            IInterface2[] GetObj();
            [DispId(1)]
            void SetObj(ref IInterface2[] obj);
        [ComVisible(true)]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        [Guid("CDC06E1D-FE8C-477E-97F1-604B73EF868F")]
        public interface IInterface2
    IF i am passing array of above interface (created in C#.Net) to VBA using GetObj API,i am getting type mismatch error in VBA while assigning the value to variable in VBA.Even assigning to variant type variable gives TypeMismatch.
    Also while passing Array of interfaces from VBA using SetObj API,excel crashes and sometimes it says method doesn't exists.
    Kindly provide some assistance regarding the same.
    Thanks

    Hi,
    I am facing issues like Type Mismatch while passing Array of interfaces from .NET  to VBA and vice versa using VSTO technology.
    My requirement is that ComInterfaceType needs to be InterfaceIsIDispatch.
    My Interface definition is somewhat like this
        [ComVisible(true)]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        [Guid("AAF48FBC-52B6-4179-A8D2-944D7FBF264E")]
        public interface IInterface1
            [DispId(0)]
            IInterface2[] GetObj();
            [DispId(1)]
            void SetObj(ref IInterface2[] obj);
        [ComVisible(true)]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        [Guid("CDC06E1D-FE8C-477E-97F1-604B73EF868F")]
        public interface IInterface2
    IF i am passing array of above interface (created in C#.Net) to VBA using GetObj API,i am getting type mismatch error in VBA while assigning the value to variable in VBA.Even assigning to variant type variable gives TypeMismatch.
    Also while passing Array of interfaces from VBA using SetObj API,excel crashes and sometimes it says method doesn't exists.
    Kindly provide some assistance regarding the same.
    Thanks

  • Problem while passing parameter from report to report.

    Hi
    I'm using forms and reports 10g, hava a problem while passing the parameter from reports to report.
    i'm using srw.set_hyperlink to call report from report.
    i have created a key value in the cgicmd.dat file called
    faccre802005-2006: report=faccre80 destype=cache desformat=pdf userid=<userid/passwd@cs> server=<servername>
    Now in the format trigger i'm using this key value
    function BTN_DEBITFormatTrigger return boolean is
    temp varchar2(5000);
    IP_ADDRESS VARCHAR2(50);
    SERVER_NAME VARCHAR2(10);
    L_ACCT_CODE VARCHAR2(14);
    begin
    SELECT MAST_INT_DESC,MAST_USER_PGM_ID INTO IP_ADDRESS,SERVER_NAME FROM MAST_INT_INFO WHERE MAST_INT_ID='VISHWA';
    temp := IP_ADDRESS||'?faccre80'||:P_FIN_YEAR||'+server='||server_name;
    temp :=temp ||'+'||'P_PREVIOUS_CODE='''||:ACCT_CODE||''''||'+'||'P_COMPANY_CODE='''||:P_COMPANY_CODE||'''';
    temp :=temp ||'+'|| 'P_FROM_DATE='''||TO_CHAR(:P_FROM_DATE,'DD-MON-RRRR')||''''||'+'|| 'P_TO_DATE='''||TO_CHAR(:P_TO_DATE,'DD-MON-RRRR')||''''||'+'||'P_TRUST_CODE='''|| :P_TRUST_CODE||'''';
    temp :=temp ||'+'|| 'P_UNIT_CODE='''||:P_UNIT_CODE||''''||'+'||' P_FIN_YEAR='''||:P_FIN_YEAR||'''';
    temp :=temp ||'+'|| 'P_LEVEL='''||:P_LEVEL||''''||'+'||'P_HEADER='''||replace(:P_HEADER,' ','%20')||''''||'+'||'P_FORMAT='''||:P_FORMAT||'''';
    SRW.Set_Hyperlink(temp);
    END;
    return (TRUE);
    end;
    Report is coming but not the expected result because parmaeters are not coming from first report to second report.
    If i dont use cgicmd file userid and password are displyed in the URL.
    Pl tell me how to pass parameter from one report to another.
    thanks and regards

    Hi
    I got the solution.
    I forgot to add %* at end of the KEY value.

  • How to pass int array as an IN parameter to PLSQL Procedure

    Hi,
    How to pass int array in java to a stored procedure througn jdbc
    and what type of data type I should declare to this IN parameter
    in PLSQL Procedure.
    Thanks,
    Simi

    Hi,
    The best way to do what you want depends on what you want.  Start by describing what you need to do.  It's best to post some sample data (CREATE TABLE and INSERT statments) and what results you want from that sample data.  (See the forum FAQ: https://forums.oracle.com/message/9362002)
    If you have ideas about how to do the job (e.g., populating a temporary table) it can be helpful to include those, too, but distinguish clearly between WHAT you need to do and HOW you might do it.
    As Bencol suggested, a SYS_REFCURSOR might be the best way to pass back the results.
    Since you didn't post your table, or even describe what you wanted to do with it, I'll illustrate using scott.emp, which is probably on your system.
    Say you wanted a procedure that took a DATE as an argument, and returned a some designated columns (empno, ename and hiredate in the example below) for all employees hired on or after the given DATE.  You might write a procedure like this:
    CREATE OR REPLACE PROCEDURE  hired_since
    (   start_date  IN   DATE
    ,   out_data    OUT  SYS_REFCURSOR
    AS
    BEGIN
        OPEN out_data FOR
            SELECT  empno, ename, hiredate
            FROM    scott.emp
            WHERE   hiredate  >= start_date;
    END  hired_since;
    SHOW ERRORS
    You can test it in SQL*Plus like this:
    VARIABLE   c REFCURSOR
    EXEC  hired_since (DATE '1982-01-01', :c);
    PRINT :c
    The output I got from this test was:
         EMPNO ENAME      HIREDATE
          7788 SCOTT      19-APR-87
          7876 ADAMS      23-MAY-87
          7934 MILLER     23-JAN-82

  • Pass an array of buttons by parameter

    Dear Java developers :
    I am asking about how can I pass an array of JButton by parameter.
    For example, I have a method that randomly picks a button that have an empty text (""), if not empty then the method recursively calls herself and so on until it finds an empty labeled button :
    private void randomPick(JButton buttons[]) {
              Random r = new Random();
              int n = r.nextInt(8);
              if (buttons[n].getText()!="") {
                   countClicks--;
                   randomPick(buttons[n]);
              } else {
                   buttons[n].setText("O");
                   buttons[n].setEnabled(false);
              countClicks++;
         }The problem is that I don't know neither how to pass the buttons[] in parameter of a method nor how to write the calling of the method properly.
    Thanks for your help,
    Hassanova.

    Ok sorry for my explanations I'll try to be more clear :
    I have 2 classes at this point : one that draws the interface, the other makes the treatment
    here is the 1st class :
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    public class TTTGameJFrameView implements ActionListener {
         JFrame frame = null;
         JButton buttons[] = new JButton[10];
         public TTTGameJFrameView() {
              setView();
         public void setView() {
              // Building the window
              frame = new JFrame("Tic Tac Toe Game");
              frame.setSize(300,300);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setLayout(new GridLayout(3,3));
              //Positioning the buttons
              for(int i = 0; i<=8; i++){
                   buttons[i] = new JButton();
                   frame.add(buttons);
                   buttons[i].addActionListener(this);
         public void close() {
              frame.dispose();
         public void display() {
              frame.setVisible(true);
         @Override
         public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
    And here is the 2nd class where I don't know how to pass by parameter the buttons declared in the 1st class to the methods and hpw to call them properly....
    package test.TicTacToe;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Random;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    public class TTTGameModel {
         JButton buttons[] = new JButton[10];
         JFrame frame = null;
         JButton buttons[] = new JButton[10];
         private void setView() {
              // Building the window
              frame = new JFrame("Tic Tac Toe Game");
              frame.setSize(300,300);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setLayout(new GridLayout(3,3));
              //Positioning the buttons
              for(int i = 0; i<=8; i++){
                   buttons[i] = new JButton();
                   frame.add(buttons);
                   buttons[i].addActionListener(this);
              frame.setVisible(true);
         private int[][] winPositions = new int[][] {
                   {0,1,2}, {3,4,5}, {6,7,8},
                   {0,3,6}, {1,4,7}, {2,5,8},
                   {0,4,8}, {2,4,6}
         private int countClicks = 0;
         private boolean win = false;
         private String buttonLetter = "";
         private String xOrO = "";
         public void actionPerformed(ActionEvent e, JButton buttons[]) {
              for(int i=0; i<=8; i++) {
                   if(e.getSource().equals(buttons[i])) {
                        buttons[i].setText("X");
                        buttons[i].setEnabled(false);
              if ((countClicks <= 8) && (win==false)) {
                   randomPick(buttons);
                   countClicks++;
                   whoWins(buttons);
                   System.out.println("click�");
              //System.out.println(countClicks);
         private void whoWins(JButton buttons[]) {
              for (int i=0; i<=7; i++) {
                   if (buttons[winPositions[i][0]].getText().equals(buttons[winPositions[i][1]].getText()) &&
                        buttons[winPositions[i][1]].getText().equals(buttons[winPositions[i][2]].getText()) &&
                        buttons[winPositions[i][0]].getText()!="")
                        win = true;
              System.out.println(countClicks + " " + win);
              showWinner(win,countClicks);
         private void showWinner(boolean isWin, int count) {
              if(count % 2 == 0)
                   xOrO = "O";
              else
                   xOrO = "X";
              if (isWin == true){
                   JOptionPane.showMessageDialog(null,"The "+xOrO+" Player Wins!");
                   System.exit(0);
              else if ((isWin == false) && (count >= 9)){
                   JOptionPane.showMessageDialog(null,"Draw Game");
                   System.exit(0);
         private void buttonClick(ActionEvent e) {
         private void randomPick(JButton buttons[]) {
              Random r = new Random();
              int n = r.nextInt(8);
              if (buttons[n].getText()!="") {
                   countClicks--;
                   randomPick(buttons[n]);
              } else {
                   buttons[n].setText("O");
                   buttons[n].setEnabled(false);
              countClicks++;
         private void randomPick(JButton button) {
              // TODO Auto-generated method stub
         public static void main(String[] args) {
              TTTGameJFrameView tt = new TTTGameJFrameView();
              tt.setView();
              tt.display();
    Thank you very much I appriciate your patience !
    Hassanova.

  • Can I pass an array as an input parameter for a stored procedure on SQL Server 2000

    I am trying to pass an array to a stored procedure residing on my SQL Server 2000 database server. Is this even possible? If it is possible, what is the syntax for this?
    Any help would be greatly appreciated.
    Thanks

    I have passed arrays to and from a database using SQL and ActiveX, including to and from stored procedures, but I cannot recall the precise method used to do so. If memory serves, everything is in the form of a string. You need to do a lot of parsing and 'unparsing' to get this data into your stored procedure.
    You are left with a couple of options to get your data to the stored procedure. I recommend using SQL in LabVIEW wherever possible as it saves the amount of external code calls (and believe me, calling ActiveX procedures developed by someone else in Visual Basic is NOT much fun at all...). You can either send the array and other data to the stored procedure (you will find the syntax in the SQL references in LabVIEW help under SQL), or you can send
    the array to the database, and have the database then act upon the array.
    I strongly recommend making routines (subVIs) to handle these operations.
    Sorry I don't have the syntax, I don't have SQL installed on this machine. If you can't find the syntax in the help, please post here again.
    -Mike Du'Lyea

  • How to pass an array or structure, in addition to a query, or multiple queries to the Report Builder as parameters

    Is there a way to pass an array or structure for example as parameters, in addition to a query, or multiple queries to the Report Builder in CF8? I believe this was recommended by users to be in CF8.

    BrianO,
    Although it's been a while, I thought I'd provide the code to do this for you. It works for me in CF8, and probably will in CF7.
    Here I create a structure called My, and provide that one parameter to my CFReportParam tag.
    <CFSet My = {
    Client = "Client Name",
    ReportDateFrom = DateFormat(ThisStartDate, DateMask),
    ReportDateTo = DateFormat(ThisEndDate, DateMask),
    PageHeaderImage = ImagePath & "\Logos\Page_Header.png",
    WatermarkImage = ImagePath & "\Logos\Watermark.png",
    GetBarSummary = GetBarSummary,
    GetPieSummary = GetPieSummary
    }>
    <CFReport Template="#ReportPath#\SpendSummary.cfr" Format="PDF" Query="GetSummary">
    <CFReportParam Name="My" Value="#My#">
    </CFReport>
    Inside the report itself, reference the given parameter as Param.My.PageHeaderImage for example. It can be referenced that way from any expression inside the report builder. You can even use the queries as the data source for charts (using the Data From a Query -> Query Builder -> Advanced) by entering "Param.My.GetPieSummary" where it says "Variable containing query object".
    HTH
    Swift

  • Problem passing multiple array lists to a single method

    Hi, all:
    I have written a generic averaging method that takes an array list full of doubles, adds them all up, divides by the size of the array list, and spits out a double variable. I want to pass it several array lists from another method, and I can't quite figure out how to do it. Here's the averager method:
         public double averagerMethod (ArrayList <Double> arrayList) {
              ArrayList <Double> x = new ArrayList <Double> (arrayList); //the array list of integers being fed into this method.
              double total = 0;//the total of the integers in that array list.
              for (int i = 0; i < x.size(); i++) {//for every element in the array list,
                   double addition = x.get(i);//get each element,
                   total = total + addition; //add it to the total,
              double arrayListSize = x.size();//get the total number of elements in that array list,
              double average = total/arrayListSize;//divide the sum of the elements by the number of elements,
              return average;//return the average.
         }And here's the method that sends several array lists to that method:
         public boolean sameParameterSweep (ArrayList <Double> arrayList) {
              sameParameterSweep = false;//automatically sets the boolean to false.
              arrayList = new ArrayList <Double> (checker);//instantiate an array list that's the same as checker.
              double same = arrayList.get(2); //gets the third value from the array list and casts it to double.
              if (same == before) {//if the third value is the same as the previous row's third value,
                   processARowIntoArrayLists(checker);//send this row to the parseAParameterSweep method.
                   sameParameterSweep = true;//set the parameter sweep to true.
              if (same != before) {//if the third value is NOT the same,
                   averagerMethod(totalTicks);//go average the values in the array lists that have been stored.
                   averagerMethod(totalNumGreens);
                   averagerMethod(totalNumMagentas);
                   sameParameterSweep = false;
              before = same; //problematic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         return sameParameterSweep;
         }Obviously, the problem is that I'm not passing the array lists from this method to the averager method the right way. What am I doing wrong?

    Encephalopathic wrote:
    There are several issues that I see, but the main one is that you are calculating average results but then just discarding them. You never assign the result to a variable.
    In other words you're doing this:
    averagerMethod(myArrayList);  // this discards the resultinstead of this:
    someDoubleVariable = averagerMethod(myArrayList); // this stores the resultAlso, do you wish to check for zero-sized array lists before calculating? And what would you return if the array list size were zero?So in solving that problem, I've come up with another one that I can't figure out, and I can't fix this problem until I fix that.
    I have several thousand lines of data. They consist of parameter sweeps of given variables. What I'm trying to do is to store pieces of
    data in array lists until the next parameter adjustment happens. When that parameter adjustment happens, I want to take the arraylists
    I've been storing data in, do my averaging thing, and clear the arraylists for the next set of runs under a given parameter set.
    Here's the issue: I'm having the devil of a time telling my application that a given parameter run is over. Imagine me doing stuff to several variables (number of solders, number of greens, number of magentas) and getting columns of output. My data will hold constant the number of soldiers, and for, say, ten runs at 100 soldiers, I'll get varying numbers of greens and magentas at the end of each of those ten runs. When I switch to 150 soldiers to generate data for ten more runs, and so forth, I need to average the number of greens and magentas at the end of the previous set of ten runs. My problem is that I can't figure out how to tell my app that a given parameter run is over.
    I have it set up so that I take my data file of, say, ten thousand lines, and read each line into a scanner to do stuff with. I need to check a given line's third value, and compare it to the previous line's third value (that's the number of soldiers). If this line has a third value that is the same as the previous line's third value, send this line to the other methods that break it up and store it. If this line has a third value that is NOT the same as the previous line's third value, go calculate the averages, clear those array lists, and begin a new chunk of data by sending this line to the other methods that break it up and store it.
    This is not as trivial a problem as it would seem at first: I can't figure out how to check the previous line's third value. I've written a lot of torturous code, but I just deleted it because I kept getting myself in deeper and deeper with added methods. How can I check the previous value of an array list that's NOT the one I'm fiddling with right now? Here's the method I use to create the array lists of lines of doubles:
         public void parseMyFileLineByLine() {
              totalNumGreens = new ArrayList <Double>();//the total number of greens for a given parameter sweep
              totalNumMagentas = new ArrayList <Double>();//the total number of magentas for a given parameter sweep.
              totalTicks = new ArrayList <Double>();//the total number of ticks it took to settle for a given parameter sweep.
              for (int i = 8; i < rowStorer.size() - 2; i++) {//for each line,
                   checker = new ArrayList <Double>();//instantiates an array list to store each piece in that row.
                   String nextLine = rowStorer.get(i); //instantiate a string that contains all the information in that line.
                   try {
                        Scanner rowScanner = new Scanner (nextLine); //instantiates a scanner for the row under analysis.
                        rowScanner.useDelimiter(",\\s*");//that scanner can use whitespace or commas as the delimiter between information.
                        while (rowScanner.hasNext()) {//while there's still information in that scanner,
                             String piece = rowScanner.next(); //gets each piece of information from the row scanner.
                             double x = Double.valueOf(piece);//casts that stringed piece to a double.
                             checker.add(x);//adds those doubles to the array list checker.
                   catch (NoSuchElementException nsee) {
                        nsee.printStackTrace();
                   //System.out.println("checker contains: " + checker);
                   processARowIntoArrayLists(checker);//sends checker to the method that splits it up into its columns.
         }

Maybe you are looking for