Return array from Procedure

can any one please tell me how to pass an dynamic array to a Procedure and get an dynamic array of values from Oracle.
Thanks,
Prasenjit

PROCEDURE sp_error_report_summary(errorDate IN VARCHAR,
                                  RESULT1   OUT Types.ref_cursor,
                                  RESULT2   OUT Types.ref_cursor,
                                  RESULT3   OUT Types.ref_cursor) IS
    error_cursor Types.ref_cursor;
BEGIN
    OPEN RESULT1 FOR
        SELECT error_message,
               site_name,
               COUNT(*) COUNT_MSG
        FROM   error_report
        WHERE  error_date = errorDate
        GROUP  BY error_message,
                  site_name
        ORDER  BY site_name;
    OPEN RESULT2 FOR
        SELECT * FROM registration;
    OPEN RESULT3 FOR
        SELECT * FROM category;
END;

Similar Messages

  • How to return cursor from procedure to jdbc

    plz help me through example of code as wl as procedure where.... return cursor from procedure to jdbc

    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS OFF
    GO
    CREATE procedure anil3 @count INT OUT,@opcode INT OUT,@total_tiff INT OUT
    as
    declare @query2 varchar(300),@tiff_count int,@query1 varchar(300)
    set @query1='declare move_cursor   cursor forward_only static for
    select count(opcode),opcode from TABLE1 group by opcode
    open move_cursor'
    exec(@query1)
    fetch next  from move_cursor into @count,@opcode
    set @opcode="'"+@opcode+"'"
    set @total_tiff=0
    while (@@fetch_status=0)
    begin
         set @query2='declare move_cursor2  cursor static for '+
         ' select count(tiff) from TABLE2  where opcode='+@opcode+
           ' open move_cursor2 '
         exec(@query2)
         fetch next  from move_cursor2 into @tiff_count
         while (@@fetch_status=0)
         begin
              set @total_tiff=@total_tiff+@tiff_count
              fetch next  from move_cursor2 into @tiff_count
         end
         close move_cursor2
         deallocate move_cursor2
    print  @total_tiff
    print @count
    print @opcode
    fetch next  from move_cursor into @count,@opcode
    end
    close move_cursor
    deallocate move_cursor
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO******************************************************************************
    above this is sql server 2000 PL/SQL and i hv to get the value
    print @total_tiff
    print @count
    print @opcode
    through JDBC
    plz help me out how to return Cursor to JDBC and HOW toPRINT THESE THREE VALUE @total_tiff, @count, @opcode through JDBC
    get this values through JDBC

  • Returning arrays from function

    Hi all,
    Can u please guide me in how to return an array from function .
    Is it possible or not ??
    If it is possible please tell me how to declare the function(prototype) that returns string array
    and how to return the string array..
    Thanks in Advance

    Hi all,
    Can u please guide me in how to return an array from
    function .
    Is it possible or not ??
    If it is possible please tell me how to declare the
    function(prototype) that returns string array
    and how to return the string array..
    Thanks in Advance
    public String [] methodReturnsAnArray()
    }

  • Please help how to get return array from rpg program on java code?

    Hi
    I have created a rpg program that returns 2 parameter 1 is the id and another one is list of array, when I called this program I passed two programparameter from my java code (see the code below) but when i checked what value would be return it is returned only first value of array. how will i get all array values ?
    please suggest me regarding this issues I amn't so much aware on java & AS400.
    try
    ProgramParameter[] parmList = new ProgramParameter[2];
    AS400Text p1 = new AS400Text(10);
    AS400Text p2 = new AS400Text(30);
    try
    parmList[0] = new ProgramParameter(10);
    parmList[1] = new ProgramParameter(30);
    parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[0].setInputData(p1.toBytes("Pune"));
    parmList[1].setInputData(p2.toBytes(" "));
    catch(Exception ex)
    ProgramCall pgm = new ProgramCall(o);
    pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
    if (pgm.run())
    byte s[] = parmList[1].getOutputData(); // HERE I got only first value of returning array.
    parmList[1].getOutputDataLength();
    //String sts = ((String) (new AS400Text(10,o).toBytes(s[0])));
    else
    AS400Message[] messageList = pgm.getMessageList();
    for (int msg = 0; msg < messageList.length; msg++) {
    catch(Exception ex)
    AS400Message[] messageList = null;
    finally
    o.disconnectAllServices();
    Reply With Quote

    Try this :
    try
    ProgramParameter[] parmList = new ProgramParameter[2];
    AS400Text p1 = new AS400Text(10);
    AS400Text p2 = new AS400Text(30);
    AS400Array arrP2 = new AS400Array(p2, 4);
    try
    parmList[0] = new ProgramParameter(10);
    parmList[1] = new ProgramParameter(30);
    parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[0].setInputData(p1.toBytes("Pune"));
    parmList[1].setInputData(arrP2.toBytes({"","","",""}));
    catch(Exception ex)
    ProgramCall pgm = new ProgramCall(o);
    pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
    if (pgm.run())
         Object[] objArr =  (Object [])arrP2.toObject( parmList[1].getOutputData() );
         for(int i =0; i<objArr.length;i++){
                System.out.println( " SKU " + i +" : " + objArr.toString());
    else
    AS400Message[] messageList = pgm.getMessageList();
    for (int msg = 0; msg < messageList.length; msg++) {
    catch(Exception ex)
    AS400Message[] messageList = null;
    finally
    o.disconnectAllServices();

  • Need help on returning arrays from C++ to Java

    Hi all, I hava a C++ application that contains a method that will return a float array to Java. I was able to write the Java Code, the JNI code to call the C++ method and compile them successfully. However on calling the native method from Java, the data in the array returned was not what I want. Please look through my code and see what is wrong with it.
    My Java Code:
    public native float[] Statistics(int inputKey); // This is the native method
    public float[] Stats(int k){ //Java method to call the native method so that I can use it in a Bean for a JSP.
    inputKey = k;
    float[] p = new float[4];
    p = Statistics(inputKey);
    return p;
    For this native method, an integer is passed from Java to the native side and the native method will use this integer to generate a float array size of 4 and populate it with data and return it back to Java.
    My JNI code
    extern "C"
    JNIEXPORT jfloatArray JNICALL
    Java_com_jspsmart_upload_FinalWaterMark_Statistics(JNIEnv *env, jobject obj, jint inputKey)
         jfloatArray floatArray = env->NewFloatArray(4); //This creates a new Java floatArray to store the C++ array
         CWatermarker2App p; // This is the C++ class to be used
         jfloat *stats = p.OnWatermarkStatistics(inputKey) // The C++ method returns a float pointer for an array of size 4
         env->SetFloatArrayRegion(floatArray, 0 , 4 , stats); //storing the C++ float array into the Java float Array
         return floatArray; // return the Array to Java
    In this example, I should have the data returned as [4952.0 2529.0 1706.0 33.6] in the array.
    But i am getting junk instead like 2.53E-23, 1.402E-15 etc..
    Is this a type conversion mistake?
    Please help!

    The first thing I notice - probably not the problem - is the line defining p. There is no reason to define this as an array of size 4, because the return from the native method is going to wipe that definition, replacing it with the return value of the native method. Alternatives:
    1. float[] p = null.
    2. float[] p = Statistics(inputKey);
    3. return Statistics(k);

  • Returned array from a method don't work properly over my Servlet

    Hi folks,
    I show you my code and then explain ;).
            double particle_sys[] = new double[100*5];
         double particle[];
      try {
             for(i = 0; i < 10; i++)
              particle_sys[i*5] = 1;
              particle_sys[i*5 + 1] = 0;
              particle_sys[i*5 + 2] = 1;
              particle_sys[i*5 + 3] = 0;
              particle_sys[i*5 + 4] = 0;     
         class call = new class();
         particle = call.MyFailingMethod(particle_sys);Now the code for the class which owns the method I call
    public class Jfjni
         static
                 System.loadLibrary("nativelibrary");
         public native void .........
         public double[] MyFailingMethod(double particle_sys[])
               double particle[] = new double[100*5];
               .... A call to a the native library to recibe the new data of particle_sys ....
             for(int i = 0; i < 10; i++)
              particle[i*5] = particle_sys[i*5];
              particle[i*5 + 1] = particle_sys[i*5 + 1];
              particle[i*5 + 2] = particle_sys[i*5 + 2];
              particle[i*5 + 3] = particle_sys[i*5 + 3];
              particle[i*5 + 4] = particle_sys[i*5 + 4];     
              return particle; 
    }A function in the native code changes the "particle_sys" array, but the returning value stills the same as the original passed to the function.
    Because of this, I have tested returning the array, dont works. I have tested also returning a copy of the array in "particle", dont works.
    Over standalone app and applet it runs correctly in all different ways, when I try it over a servlet the values of the array stand the same as before the method call.
    Please suggestions!
    Edited by: bifiado on Jan 15, 2008 10:27 AM
    Edited by: bifiado on Jan 15, 2008 10:28 AM

    I have partially solutioned this mistake but I have collateral ones. Looks like I forgot to put in web.xml the definition of the class I was calling from the principal servlet class. In other words, I have two classes, one is the extension of Httpservlet and the other (the class that make mistakes) is a class I call to do the JNI work.
    Now, I added in web.xml the definition of the JNI class (before I forgot) and looks the mistakes with arrays works, but know the there's a new problem and get an IOexception on the applet that call the servlet. When I coment the JNI calls the exception dissapears and all works ok, but I am not getting any exception report on the tomcat ".out".
    Please suggestions.

  • Returning nodes from procedures

    What is the safest way to return nodes?
    Have a group of packages which combined create an xmlDocument.
    Level 1 calls level 2 1+ times.
    Level 2 calls any level 3 1+ times (in any order).
    Tried (amongst other alternatives) returning Fragments and
    cloning them in to the main document, but after several
    successful executions oracle fails to create xml objects.
    Only by starting a new session will the procedures work again.
    Heres a simplified look at the code.
    procedure get_level3Node_001(in_id, out_frag)
    procedure get_level3Node_010(in_id, out_frag)
    procedure get_level2Node(in_id, out_frag)
    procedure get_level1Node()
    when a node is returned from a procedure it is handled like this:
    -- xmlDoc is the local document in the procedure
    -- xmlNode is the active/current Node
    -- xmlFrag is returned from another procedure
    -- xmlFrag was created from a separate xmlDocument
    xmlNode1 := xmldom.makeNode(xmlFrag);
    xmlNode2 := xmldom.makeNode(xmlDoc);
    xmlNode2 := xmldom.cloneNode(xmlNode1, TRUE);
    xmlNode := xmldom.appendChild(xmlNode, xmlNode2);
    xmlNode := xmldom.getParentNode(xmlNode);
    xmldom.freeDocument(xmldom.getOwnerDocument(xmlNode1));
    Really need help fast!

    Not much help, but I couldn't tell you how to do this using PDO. If however, you want to know how to do it without PDO (i.e. via OCI8 PHP functions directly), let me know and I will post some code...

  • Returning arrays from methods

    Hello,
    I'm trying to write a program that is structured like this;
    - The first method gets the user to enter 20 integers, which are stored in an array.
    - This method is then supposed to return this array.
    - The main method calls the first method (the one with the array).
    - The main method then calls another method which finds the highest value in the array passed to it (from the initial method) and then prints this value.
    I've tried for about 2 hours now though, and can't get it to return the array.
    Bear in mind I'm a novice at Java. I'll put my code below. Any help on this would be really appreciated because I'm totally stumped.
    public class part1
         static int counter=20;
         public static void enterMarks()
                   int classMarks[] = new int[20];
                   for (int i=0; i<20; i++)
                             classMarks[i] = getScannerInput.anInt("Please enter an integer value between 0 and 20 for each mark :");
                             System.out.println();
                             System.out.print("The marks entered were ");
                             for (int j=0; j<counter; j++)
                                       System.out.print(classMarks[j]+", ");
         public static void max()
    //               int[] classMarks2=classMarks;
         public static void main(String args[])
                   int[] marks=enterMarks();
    }Can someone tell me how I need to alter this so that the first method will return the array? Thanks in advance.

    Thanks for all the help so far everyone, I'm finally getting somewhere, but I've another problem. Here's my current code:
         static int counter=20;
         public static int[] enterMarks()
                   int classMarks[]= new int[counter];
                   for (int i=0; i<counter; i++)
                             classMarks[i] = getScannerInput.anInt("Please enter an integer value between 0 and 20 for each mark :");
                             System.out.println();
                             System.out.print("The marks entered were ");
                             for (int j=0; j<counter; j++)
                                       System.out.print(classMarks[j]+", ");
                                  return classMarks;     
         public static int max(int arr[])
                   int[] marks = classMarks;
                   int tempStore=0;
                   for (int k=0;k<counter;k++)
                        if(marks[k]>marks[k+1])
                        tempStore=marks[k];
                   return tempStore;
         public static void main(String args[])
                   int[] marks = enterMarks();
    }When I try to compile that, I'm told that the variable classMarks may not have been initialised. Surely it should be getting classMarks from the first method now that the first method is set up to return the array?

  • Return Resultset from Procedure

    Hi --
    This may seem like a very elementary question, but can anyone tell me how to return a resultset from a function or procedure?
    Thanks,
    Christine

    if i understand your question correctly. a function return value is mandatory. while procedure is optional you had to use the out at the parameters. examples:
    CREATE OR REPLACE FUNCTION get_age (pBday Date) RETURN number IS
      vAge          Number := 0;
    BEGIN
      vAge := (Months_Between(sysdate,pBday) / 12);
      Return (vAge);
    END;
    CREATE OR REPLACE PROCEDURE get_age_procedure (pBday In Date, pAge Out Number) IS
    BEGIN
      pAge := (Months_Between(sysdate,pBday) / 12);
    END;
    /you need to create a reference cursor type object to achieve a result sets.
    CREATE OR REPLACE package TYPES AS
        TYPE cursorType IS REF CURSOR;
    END;

  • Returning resultset from procedure...or pkg

    I am a newbie to Oracle but am steeped in MSSQL. I am accustomed to using a procedure to execute and produce a result set as its output from various input parameters thus keeping query complexity and details as a part of the database tier.
    Is there a best practice in Oracle that provides this capability? Is the 'ref cursor' the correct container to hold the recordset data (usually combined from various base tables...counts and sums for reports etc) and how should it be returned to a calling application (web page) to be iterated through? Perhaps as an output parameter?
    Thank you for helping with such a basic problem.

    Yes you would use a ref cursor, though it does not hold the results anywhere, they are fetched as needed, which is why it scales well.
    Re: OPEN cursor for large query
    Re: cursor ,inner join
    You can return a ref cursor from a function or procedure, it would be no different in a package.
    SQL> create or replace function f (p_deptno in number)
      2  return sys_refcursor as
      3    c sys_refcursor;
      4  begin
      5    open c for
      6      select empno, ename, job, sal from emp
      7        where deptno = p_deptno;
      8    return c;
      9  end;
    10  /
    Function created.
    SQL> var c refcursor
    SQL> exec :c := f(10)
    PL/SQL procedure successfully completed.
    SQL> print c
    EMPNO ENAME      JOB          SAL
      7782 CLARK      MANAGER     2450
      7839 KING       PRESIDENT   5000
      7934 MILLER     CLERK       1300
    SQL> create or replace procedure p
      2    (p_deptno in number, p_c out sys_refcursor)
      3  as
      4  begin
      5    open p_c for
      6      select empno, ename, job, sal from emp
      7        where deptno = p_deptno;
      8  end;
      9  /
    Procedure created.
    SQL> exec p(30, :c)
    PL/SQL procedure successfully completed.
    SQL> print c
    EMPNO ENAME      JOB          SAL
      7499 ALLEN      SALESMAN    1600
      7521 WARD       SALESMAN    1250
      7654 MARTIN     SALESMAN    1250
      7698 BLAKE      MANAGER     2850
      7844 TURNER     SALESMAN    1500
      7900 JAMES      CLERK        950
    6 rows selected.
    SQL>There are examples how to reference them in other languages here, note this was pre-9i when the built in sys_refcursor type was provided.
    http://asktom.oracle.com/tkyte/ResultSets/index.html

  • Stored Procedure: Function returns Array

    I was just wondering if following scenario is possible in a stored procedure.
    I have a package, which includes 4 different functions and 1 procedure. Procdure uses ref cursor to return values in my reporting tool. What I am trying to do is to write a function which takes input and return array of varchar. Something like..
    Package ABC
    Function student_classes (student_no in Varchar2) return [array]
    begin
    select class_nbr into [array]
    from student_table
    where student_nbr = student_no;
    return [array];
    end student_classes;
    procedure students_info (rpt_cursor IN OUT rpt_type)
    begin
    OPEN rpt_cursor FOR
    select
    student_name,
    student_nbr,
    student_address,
    student_classes (student_nbr) --returns array
    from student_table;
    end student_info; --end of procedure
    end abc; --end of pacakge.
    I used [array], as I am ont sure how to define (syntax) it in spec part of package or in body. I will really appreciate if someone could help me with this function.
    Thank you

    Thanks for the reply Tonguc Y.
    I declared an array in my package declaration
    CREATE OR REPLACE PACKAGE rpt_TESTING_pkg
    AS TYPE rpt_type IS REF CURSOR;
         TYPE DIAGARRAY IS VARRAY(20) OF VARCHAR2(6);
         FUNCTION DIA_CODES (MNO IN VARCHAR2) RETURN DIAGARRAY;
         PROCEDURE member (rpt_cursor IN OUT rpt_type);
    END rpt_TESTING_pkg;
    but then when I try to use it in my function it gives me error that I should declare DIAGARRAY.
    CREATE OR REPLACE PACKAGE BODY rpt_TESTING_pkg
    as
    FUNCTION DIA_CODES (MNO IN VARCHAR2)
                   RETURN DIGARRAY AS diags DIGARRAY;
    begin
    <sql block>
    end dia_codes;
    end rpt_TESTING_pkg;
    Any suggestions.

  • Returing array from PL/SQL procedure

    Hi,
    I am trying to return array from PL/SQL procedure. Heres is the code. I am getting an error "OracleParameter.ArrayBindSize is invalid ".
    Will anybody let me know what is wrong in following code. or does anybody have code to return PL/SQL array using VB.NET.
    oCommand.CommandText = "MyPack.TestVarchar2"
    oCommand.CommandType = CommandType.StoredProcedure
    Dim id As Integer = 10
    Dim deptname As String()
    Dim oParam1 As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter("id", Oracle.DataAccess.Client.OracleDbType.Int32)
    Dim oParam2 As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter("deptname", Oracle.DataAccess.Client.OracleDbType.Varchar2)
    oParam1.Direction = ParameterDirection.Input
    oParam2.Direction = ParameterDirection.Output
    oParam1.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.None
    oParam2.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    oParam1.Value = id
    oParam2.Value = ""
    oParam1.Size = 10
    oParam2.Size = 20
    oCommand.Parameters.Add(oParam1)
    oCommand.Parameters.Add(oParam2)
    oCommand.ExecuteNonQuery()
    Thanks
    Sameer

    Thanks Arnold for the reply..
    Yes, I am trying to get result set in array which is unknow to me (No of rows return by the query). For the test I will pre-define the result set so that I will able to set ArrayBindSize.
    I have read C# example but when I try to write it in VB.NET it gives me syntax error when I try to set the ArrayBindSize.
    oParam.ArrayBindSize = new int[3]{15,23,13} // individual max size of 3 outputsWill you please let me know how to set ArrayBindSize (VB.NET) because I am new to this..
    There is an example at otn "How to: Bind an Array to an ODP.NET Database Command" which does multiple INSERTs in one trip to database. This works fine. I need to do same for the SELECT statement which will return me multiple rows. I do not mean refCursor. If I use refCursor, it will make soft parse which I am trying to avoid using this Array techniq.
    Thanks
    Sameer

  • Returning String[] from C program

    How can I return a string[] from a cprogram to a java program?
    private native String[] readRFIDData();
    JNIEXPORT jobjectArray JNICALL Java_RfidDM_readRFIDData
    (JNIEnv *, jobject);
    Above is the definition of a jni method .
    I have gone through the sample code, but they explain how to return arrays from C++.
    Can someone please suggest? I am not good at C.
    Much thanks,
    Ann

    Thanks Scott.
    This code works fine for me...
         jclass sclass = (*env)->FindClass(env, "java/lang/String");
         jobjectArray ret = (*env)->NewObjectArray(env, length, sclass, NULL);
         for(i=0;i<37;i++){
              (*env)->SetObjectArrayElement(
                   env,ret,i,(*env)->NewStringUTF(env,&buf));     
              printf(&buf[i]);

  • Invoking stored procedure that returns array(oracle object type) as output

    Hi,
    We have stored procedures which returns arrays(oracle type) as an output, can anyone shed some light on how to map those arrays using JPA annotations? I tried using jdbcTypeName but i was getting wrong type or argument error, your help is very much appreciated. Below is the code snippet.
    JPA Class:
    import java.io.Serializable;
    import java.sql.Array;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import org.eclipse.persistence.annotations.Direction;
    import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
    import org.eclipse.persistence.annotations.StoredProcedureParameter;
    * The persistent class for the MessagePublish database table.
    @Entity
    @NamedStoredProcedureQuery(name="GetTeamMembersDetails",
         procedureName="team_emp_maintenance_pkg.get_user_team_roles",
         resultClass=TeamMembersDetails.class,
         returnsResultSet=true,
         parameters={  
         @StoredProcedureParameter(queryParameter="userId",name="I_USER_ID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="employeeId",name="I_EMPLOYEEID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="TEAMMEMBERSDETAILSOT",name="O_TEAM_ROLES",direction=Direction.OUT,jdbcTypeName="OBJ_TEAM_ROLES"),
         @StoredProcedureParameter(queryParameter="debugMode",name="I_DEBUGMODE",direction=Direction.IN,type=Long.class)
    public class TeamMembersDetails implements Serializable {
         private static final long serialVersionUID = 1L;
    @Id
         private long userId;
         private List<TeamMembersDetailsOT> teamMembersDetailsOT;
         public void setTeamMembersDetailsOT(List<TeamMembersDetailsOT> teamMembersDetailsOT) {
              this.teamMembersDetailsOT = teamMembersDetailsOT;
         public List<TeamMembersDetailsOT> getTeamMembersDetailsOT() {
              return teamMembersDetailsOT;
    Procedure
    PROCEDURE get_user_team_roles (
    i_user_id IN ue_user.user_id%TYPE
    , o_team_roles OUT OBJ_TEAM_ROLES_ARRAY
    , i_debugmode IN NUMBER :=0)
    AS
    OBJ_TEAM_ROLES_ARRAY contains create or replace TYPE OBJ_TEAM_ROLES_ARRAY AS TABLE OF OBJ_TEAM_ROLES;
    TeamMembersDetailsOT contains the same attributes defined in the OBJ_TEAM_ROLES.

    A few things.
    You are not using a JDBC Array type in your procedure, you are using a PLSQL TABLE type. An Array type would be a VARRAY in Oracle. EclipseLink supports both VARRAY and TABLE types, but TABLE types are more complex as Oracle JDBC does not support them, they must be wrapped in a corresponding VARRAY type. I assume your OBJ_TEAM_ROLES is also not an OBJECT TYPE but a PLSQL RECORD type, this has the same issue.
    Your procedure does not return a result set, so "returnsResultSet=true" should be "returnsResultSet=false".
    In general I would recommend you change your stored procedure to just return a select from a table using an OUT CURSOR, that is the easiest way to return data from an Oracle stored procedure.
    If you must use the PLSQL types, then you will need to create wrapper VARRAY and OBJECT TYPEs. In EclipseLink you must use a PLSQLStoredProcedureCall to access these using the code API, there is not annotation support. Or you could create your own wrapper stored procedure that converts the PLSQL types to OBJECT TYPEs, and call the wrapper stored procedure.
    To map to Oracle VARRAY and OBJECT TYPEs the JDBC Array and Struct types are used, these are supported using EclipseLink ObjectRelationalDataTypeDescriptor and mappings. These must be defined through the code API, as there is currently no annotation support.
    I could not find any good examples or doc on this, your best source of example is the EclipseLink test cases in SVN,
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/plsql/
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/customsqlstoredprocedures/
    James : http://www.eclipselink.org

  • Return results from ADEP in AS3 Arrays, not ArrayCollections

    Hi all,
    Is there any way to force ADEP to return results from data services in simple AS3 Arrays, not ArrayCollections? Here are my situation:
    In my project I use ADEP Data Management Services. To connect to ADEP services we use RTMP channel defined in services-config.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <services-config>
         <services>
              <service-include file-path="remoting-config.xml" />
              <service-include file-path="proxy-config.xml" />
              <service-include file-path="messaging-config.xml" />
              <service-include file-path="data-management-config.xml" />
              <service-include file-path="managed-remoting-config.xml" />
              <service class="fiber.data.services.ModelDeploymentService" id="model-deploy-service" />
              <default-channels>
                   <channel ref="my-rtmp"/>
              </default-channels>
         </services>
         <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
              <endpoint url="rtmp://{server.name}:1000" class="flex.messaging.endpoints.RTMPEndpoint"/>
              <properties>
                   <idle-timeout-minutes>20</idle-timeout-minutes>
                   <block-rtmpt-polling-clients>true</block-rtmpt-polling-clients>
                   <rtmpt-poll-wait-millis-on-client>0</rtmpt-poll-wait-millis-on-client>
              </properties>
         </channel-definition>
    </services-config>
    To manage data in database we defined data services in data-management-config.xml like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="data-service" class="flex.data.DataService">
        <adapters>
            <adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter"/>
            <adapter-definition id="mr-java-dao" class="flex.data.adapters.ManagedRemotingDataAdapter" />
            <adapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/>
        </adapters>
        <default-channels>
            <channel ref="my-rtmp"/>
        </default-channels>
        <destination id="SomeProduct.SomeItems">
            <adapter ref="java-dao" />
            <properties>
                <source>flex.data.assemblers.SQLAssembler</source>
                <scope>application</scope>
                <metadata>
                    <identity property="ID" />
                </metadata>
                <server>
                    <database>
                        <datasource>java:comp/env/jdbc/SP</datasource>
                    </database>
                    <actionscript-class>com.somecompany.classes.SomeCoolClass</actionscript-class>
                    <create-item>
                        <procedure name="SomeItems_Insert">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Division_ID#" />
                            <procedure-param property-value="#Salesrep_ID#" />
                            <procedure-param property-value="#Area_Code#" />
                            <procedure-param property-value="#Item_ID#" />
                        </procedure>
                        <id-query>SELECT IDENT_CURRENT('Work_Area_Item')</id-query>
                    </create-item>
                    <fill>
                        <name>all</name>
                        <procedure name="SomeItems_Get">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Last_Sync_Time#" />
                        </procedure>
                    </fill>
                    <update-item>
                        <procedure name="SomeItems_Update">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Division_ID#" />
                            <procedure-param property-value="#Salesrep_ID#" />
                            <procedure-param property-value="#Area_Code#" />
                            <procedure-param property-value="#Item_ID#" />
                       </procedure>
                    </update-item>
                    <delete-item>
                        <procedure name="SomeItems_Delete">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Item_ID#" />
                        </procedure>
                    </delete-item>
                </server>
            </properties>
        </destination>
    </service>
    By default, ADEP returns results from SomeProduct.SomeItems destination to Flex side as ArrayCollection of SomeCoolClass instances but I need the data to be returned in simple AS3 Arrays. Recently, I found that there is small optional serialization configuration in channel-definition that should resolve my problem. So I updated my channel-definition in services-config.xml to this:
    <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
         <endpoint url="rtmp://{server.name}:1000" class="flex.messaging.endpoints.RTMPEndpoint"/>
         <properties>
              <serialization>
                   <legacy-collection>true</legacy-collection>
              </serialization>
              <idle-timeout-minutes>20</idle-timeout-minutes>
              <block-rtmpt-polling-clients>true</block-rtmpt-polling-clients>
              <rtmpt-poll-wait-millis-on-client>0</rtmpt-poll-wait-millis-on-client>
         </properties>
    </channel-definition>
    However, result are still returned in ArrayCollections.
    Any ideas?
    Thanks in advance

    Thom Parker answered this here: http://forums.adobe.com/message/2614570#2614570
    Answer copied below:
    "The problem is that when the focus is on the text box
    it's in edit mode. It's only displaying the value interactively entered by
    the user, or as a consequence of the change event.  What you need to do is
    force the focus off of the text box in code.  You can do a little trick
    where you bounce it to a tiny transparent field, which then bounds the focus
    back so it doesn't look like the focus changed."
    What I ended up doing was calling up the dialog box, then using setfocus with no parameters to remove focus from the field, as follows:
    this.rawValue = this.dialogBoxFunction(this.rawValue); // passing current value so dialog box defaults to that value
    xfa.host.setFocus();
    Cheers,
    Marty.

Maybe you are looking for