Referencing package table type from Java

Hi,
In my package spec, I have a table type defined. I just want to refer this from Java program in order to pass ARRAY object to a procedure inside the package. But I keep getting an errory saying "Invalid name pattern".
But If I declare the type outside of the package, it works fine. Can anyone help me on this?
Regards,
Poornachandran R

Hi,
create or replace package msproot.spear$util as
-- UUID table type
type varchar32_t is table of varchar2(32) index by binary_integer;
* Function name: getUUID
* Desc: Retreive a unique id.
* IN: maxNumOfUUID - integer, the quentity of UUID to generate, optional default 1.
* OUT: UUID - an array of 32 characters string of UUID
function getUUID(maxNumOfUUID number :=1 ) return varchar32_t;
end spear$util;
create or replace package body msproot.spear$util as
-- get uuid - retun more the one UUID
function getUUID(maxNumOfUUID number) return varchar32_t is
uuidArr varchar32_t;
begin
-- generate the array of uuid up to maxNumOfUUID
for i in 1..maxNumOfUUID loop
select sys_guid into uuidArr(i) from dual;
end loop;
return (uuidArr);
end getUUID;
end spear$util;
private String[] retrieveUuid(int maxNumOfUUID) throws Exception
String[] arr = null;
try {
// generate a free spear ids array from the database
// Use a PL/SQL block to open the stored procedure
OracleCallableStatement ocstmt =
(OracleCallableStatement) conn
.prepareCall("begin ? := spear$util.getUUID(?); end;");
// index-by table element type
int elemSqlType = OracleTypes.CHAR;
// index-by table element length in case the element type
// is CHAR, VARCHAR or RAW. This value is ignored for other
// types
int elemMaxLen = 32;
// register the return parameter
ocstmt.registerIndexTableOutParameter(1, maxNumOfUUID, elemSqlType,
elemMaxLen);
// register the number of UUIDes to generate
ocstmt.setInt(2, maxNumOfUUID);
// run the stored procedure
ocstmt.execute();
// access the value using JDBC default mapping
arr = (String[]) ocstmt.getPlsqlIndexTable(1);
// close the cursor
ocstmt.close();
} catch (SQLException x) {
System.out.println(errorMessage + x.toString());
throw new Exception(errorMessage + x.getMessage());
return arr;
Best,
EA

Similar Messages

  • Accessing  table type from JAVA

    Hi Experts,
    We are making a custom copy of the std FM COM_BPUS_ORG_CONTPERS_REGISTER .
    It is observed that Tables are obsolete and we should not use them in custom function modules.
    I can pass a table type in import parameter and export parameter.
    Can we access a table type from java layer.
    Also, note that this STANDARD function module has parameter IT_BUSINESSPARTNERROLE_ORG which has table type BU_ROLE_T.
    Is it possible to access this?
    Note:- This Function module is not getting called in standard web shops.
    Please let me now how i can access this table type for hava while calling FM so as to input or retrieve valus from it.
    Regards
    Antony

    The issue with you is more than accessing a table type.
    You said:
    This Function module is not getting called in standard web shops.
    For function modules that are not called as a part of the standard flow, you have to develop your own simple BOM, BO, BEI, BE classes and methods to call the custom RFC - the whole nine yards. See the extension guide and see the Extension Demos 2 and 3 for reference.
    See the sample JCO calls from Java to understand how to access the table types.

  • How to call nested table type from Java

    I needed a 2 dimensional array and asked the questuion here.
    [Original thread| http://forums.oracle.com/forums/message.jspa?messageID=3419944#3419944]
    I have my program working correctly in pl/sql.
    The java guys are building this array and passing it in to me, but they don't know how.
    A small example of this would be appreciated.
    Heres an example of the procedure prototype and the type definitions in use
    create or replace
    type csn_array_obj
    as object
    (csn varchar2(20 char),
    box_id varchar2(10)
    create or replace
    type csn_array_type is table of csn_array_obj;
    procedure populate_stock(
    p_csn_array in csn_array_type
    added in example of object and type definition.

    There's an orl Oramag article by Tom Kyte rounding up [some Java tips|http://asktom.oracle.com/tkyte/omag/00-nov/o60tom.html] which includes an example of how to do this. You'll need to replace Tom's SIMPLARRAY with your own type.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Alter table type from COLUMN to ROW

    TABLE type can be changed from ROW to COLUMN (and vice versa) using the ALTER TABLE command .
    Lars Breddemann  wrote
    when considering which data store to choose (which, by the way, can be changed later on as well), you have to take into account:
    * will you usually need the complete row (all columns)? If so, row store may be more efficient, as reconstructing the complete row is one of the most expensive column store operations.
    * will you need to join the row-store table to a column store table? If so, you should avoid using a different storage type, since using both storage engines in a statement leads to intermediate result set materialization which is another name for bad performance.
    * do you want to fill the table with huge amounts of data, that should be aggregated and analysed? If this is the case, the column store is the better option.
    As a rule of thumb you may just start with column-store tables and change them to row-store tables when you encounter performance issues.
    In general most developers cannot anticipate all important use cases for the tables they design.
    This is especially true for living and growing systems.
    So, more important than choosing the 'right' storage in the beginning is to monitor the performance and to benchmark the differences when changing the storage engine.
    So suppose we have a COLUMN table , but would be requiring to get data from many columns (so would be a very expensive column operation) , would it be advisable to change the table type FROM COLUMN to ROW on the fly . would this be a resource intensive operation if the table has a lot of data ?
    Lets suppose , if the above can be done , but there exists a interdependency for the column table (say from another simultaneous operation) , and thus should remain as COLUMN table as such . so what would be the better option in this case .
    Creating views is not an option as it seems from the SQL guide , that there was not an option to create a ROW view from a COLUMN table. ?
    Edited by: Rajarshi Muhuri on Nov 27, 2011 3:25 AM

    Dear Rajashri,
    1. you cann't alter table from column to row using alter command.
    but you can achieve this through Stored procedure, just Little bit HSQL coding.
    I hope upcoming versions SAP Gives like following SQL statements  ( following statemnt not works in HANA works in oralce )
       create row table "EFASHION_TUTORIAL"."AAA" as
    select
    "ARTICLE_COLOR_LOOKUP_ID",
    "ARTICLE_ID",
    "COLOR_CODE",
    "ARTICLE_LABEL",
    "COLOR_LABEL",
    "CATEGORY",
    "SALE_PRICE",
    "FAMILY_NAME",
    "FAMILY_CODE"
    from "EFASHION_TUTORIAL"."ARTICLE_COLOR_LOOKUP";
    2. Row & column table two different purpose like OLTP & OLAP.
         when you think about OLAP means modeling use Column.
          when you think about OLTP means real time operations then use Row
    Column table is high compress ( 5 - 20X),  i don't think you want get any performance issue when read information from column table. that is actual Core engine reading parller process. ( that is Heart of HANA).
    Column table purpose quite different like calculations, grouping.. most of DW environment Queires.
    Row table is currently system tables in feature row tables as OLTP, it's less compress mode compress to column store.
    so finally you write small program convert column to row and row to column
    thanks
    Rao

  • Passing Tables back from Java Stored Procedures

    Thomas Kyte has written (in reference to
    trying to pass an array back from a stored
    function call):
    You can do one of two things (and both require the use of
    objects). You cannot use PLSQL table types as JDBC cannot bind to
    this type -- we must use OBJECT Types.
    [snip]
    Another way is to use a result set and "select * from
    plsql_function". It could look like this:
    ops$tkyte@8i> create or replace type myTableType as table of
    varchar2 (64);
    2 /
    Type created.
    ops$tkyte@8i>
    ops$tkyte@8i>
    ops$tkyte@8i> create or replace
    2 function demo_proc2( p_rows_to_make_up in number )
    3 return myTableType
    4 as
    5 l_data myTableType := myTableType();
    6 begin
    7 for i in 1 .. p_rows_to_make_up
    8 loop
    9 l_data.extend;
    10 l_data(i) := 'Made up row ' | | i;
    11 end loop;
    12 return l_data;
    13 end;
    14 /
    Function created.
    ops$tkyte@8i>
    ops$tkyte@8i> select *
    2 from the ( select cast( demo_proc2(5) as mytableType )
    3 from dual );
    COLUMN_VALUE
    Made up row 1
    Made up row 2
    Made up row 3
    Made up row 4 [Image]
    Made up row 5
    So, your JDBC program would just run the query to get the data.
    If the function "demo_proc2" cannot be called from SQL for
    whatever reason (eg: it calls an impure function in another piece
    of code or it itself tries to modify the database via an insert
    or whatever), you'll just make a package like:
    ops$tkyte@8i> create or replace package my_pkg
    2 as
    3
    4 procedure Make_up_the_data( p_rows_to_make_up in
    number ); 5 function Get_The_Data return myTableType;
    6 end;
    7 /
    Package created.
    ops$tkyte@8i>
    ops$tkyte@8i> create or replace package body my_pkg
    2 as
    3
    4 g_data myTableType;
    5
    6 procedure Make_up_the_data( p_rows_to_make_up in number )
    7 as
    8 begin
    9 g_data := myTableType();
    10 for i in 1 .. p_rows_to_make_up
    11 loop
    12 g_data.extend;
    13 g_data(i) := 'Made up row ' | | i;
    14 end loop;
    15 end;
    16
    17
    18 function get_the_data return myTableType
    19 is
    20 begin
    21 return g_data;
    22 end;
    23
    24 end;
    25 /
    Package body created.
    ops$tkyte@8i>
    ops$tkyte@8i> exec my_pkg.make_up_the_data( 3 );
    PL/SQL procedure successfully completed.
    ops$tkyte@8i>
    ops$tkyte@8i> select *
    2 from the ( select cast( my_pkg.get_the_data as mytableType
    ) 3 from dual );
    COLUMN_VALUE
    Made up row 1
    Made up row 2
    Made up row 3
    And you'll call the procedure followed by a query to get the
    data...
    I have tried this, and it works perfectly.
    My question, is what does the wrapper look
    like if the stored function is written
    in java instead of PL/SQL? My experiments
    with putting the function in java have been
    dismal failures. (I supposed I should also
    ask how the java stored procedure might
    look also, as I suppose that could be where
    I have been having a problem)
    null

    Thanks for the response Avi, but I think I need to clarify my question. The articles referenced in your link tended to describe using PL/SQL ref cursors in Java stored procedures and also the desire to pass ref cursors from Java to PL/SQL programs. Unfortunately, what I am looking to do is the opposite.
    We currently have several Java stored procedures that are accessed via select statements that have become a performance bottleneck in our system. Originally the business requirements were such that only a small number of rows were ever selected and passed into the Java stored procedures. Well, business requirements have changed and now thousands and potentially tens of thousands of rows can be passed in. We benchmarked Java stored procedures vs. PL/SQL stored procedures being accessed via a select statement and PL/SQL had far better performance and scaleable. So, our thought is by decouple the persistence logic into PL/SQL and keeping the business logic in Java stored procedures we can increase performance without having to do a major rewrite of the existing code. This leads to the current problem.
    What we currently do is select into a Java stored procedure which has many database access calls. What we would like to do is select against a PL/SQL stored procedure to aggregate the data and then pass that data via a ref cursor (or whatever structure is acceptable) to a Java stored procedure. This would save us a significant amount of work since the current Java stored procedures would simple need to be changed to not make database calls since the data would be handed to them.
    Is there a way to send a ref cursor from PL/SQL as an input parameter to a Java stored procedure? My call would potentially look like this:
    SELECT java_stored_proc(pl/sql_stored_proc(col_id))
    FROM table_of_5000_rows;
    Sorry for the lengthy post.

  • Calling packaged stored procedure from Java

    Hi All,
    I'm trying to call a stored procedure from Java but I'm having
    problems with registrating the output parameter. I'm getting
    the error: Conflicting parameters.: sqltype=2003
    This is the stored procedure which is located in a package in
    the Oracle database:
    package Pack_GetAgencyInformation as
    Type InfoType is record ( agen_code varchar(3), agen_designation
    varchar(30), agen_adresse varchar(60), agen_tel varchar(12) );
    function GetAgencyInformation( P_AGENCE VARCHAR )
    return Pack_GetAgencyInformation.InfoType
    end Pack_GetAgencyInformation;
    This is the Java source from where I'm calling the procedure:
    //DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
         Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@164.48.69.125:1521:ventes", "system", "*****
    // @machineName:port:SID,
    userid, password
    CallableStatement cs = conn.prepareCall("{ ? = call
    Pack_GetAgencyInformation.GetAgencyInformation( ? )}");
         try {
              cs.registerOutParameter( 1,
    oracle.jdbc.driver.OracleTypes.ARRAY);
         } catch (SQLException e) {
              e.printStackTrace();
         cs.setString(2, "001" );
         //ResultSet rset = cs.executeQuery();
    The stacktrace:
    java.sql.SQLException: Parametertypen conflicteren.:
    sqlType=2003
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:210)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:220)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:350)
    at dbAccess.main(dbAccess.java:25)
    I think it has to do with the type InfoType which is created in
    the Stored Procedure. I'm absolute no Oracle expert and I
    prefer not to make changes to the Oracle database. So any
    solution in Java is welcome!
    BR, H.Rietman

    I managed to get it to work only by changing the stored
    procedure. I have changed the return type record to a Ref
    Cursor type (had to change alot of code for this). It seams
    that Oracle JDBC drivers DON'T support the Record type as a
    return type.
    So the next question is: is it possible to typecast a record
    type to a ref cursor type in Oracle. In this way I can easily
    change the return type for the stored procedures.
    /Harald

  • Can't access packaged object type in Java

    Hi
    I am getting the following error while accessing an oracle packaged object type. Can You please give me an advise..!!
    java.sql.SQLException: invalid name pattern: XXGW_RMA_CREATION_PKG.XXGW_RMA_RECRegards

    HI
    I am not asking how to search in google. If You know how to resolve my problem..then help me. I don't what this kind of answers.
    This is my problem
    Error in java.
    java.sql.SQLException: invalid name pattern: XXGW_RMA_CREATION_PKG.XXGW_RMA_REC
    This is my package
    create or replace package xxgw_rma_creation_pkg
    is
    type xxgw_rma_rec is record (dealer_name varchar2(40), dealer_desc varchar2(300));
    type xxgw_rma_line is table of xxgw_rma_rec; --(item_name varchar2(40), item_desc varchar2(300)) index by binary_integer;
    xx_rma_rec  xxgw_rma_rec;
    xx_rma_line xxgw_rma_line
    procedure xxgw_rma_creation (p_rma_rec in xxgw_rma_rec ,p_rma_line in xxgw_rma_line,p_rma_no out varchar2);
    end;
    create or replace package body xxgw_rma_creation_pkg
    is
    procedure xxgw_rma_creation (p_rma_rec in xxgw_rma_rec ,p_rma_line in xxgw_rma_line,p_rma_no out varchar2)
    is
    l_rma_rec xxgw_rma_rec := p_rma_rec;
    l_rma_line xxgw_rma_line := p_rma_line;
    begin
    dbms_output.put_line(l_rma_rec.dealer_name||'  '||l_rma_rec.dealer_desc);
    for i in  l_rma_line.first..l_rma_line.last loop
    dbms_output.put_line(l_rma_line(i).dealer_name||'  '||l_rma_line(i).dealer_desc);
    end loop;
    p_rma_no := '20';
    end;
    end;Rekha

  • Whats the quickest way to export packages,tables etc from one enviroment

    Hi
    whats the quickest way of more loads of packages, tables, indexes etc. from one enviroment to another?
    I did some things in apex.oracle.com workspace to test apex now I want to move it across to my xe installation.

    Hello,
    2 'fast' options really -
    1) Export of application + Export/DataPump of schema
    This works if you want a complete 'mirror' from one environment to another of the schema objects
    2) Supporting Objects
    Bundle all your requirements together with the application export.
    The Supporting Objects feature absolutely rocks and yet very very (very!) few people seem to use it.
    John.
    http://jes.blogs.shellprompt.net
    http://apex-evangelists.com

  • How to call stored procedure having parameter as oracle type from java???

    Hello,
    I have created following type & stored procedure in oracle. How can i call this stored procedure from my java class?
    I want to pass 2d array to this procedure.
    CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
    CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
    CREATE OR REPLACE PROCEDURE INSERTEMP (pp in tbl_survey)
    IS
    BEGIN
    FOR I IN pp.FIRST .. pp.LAST
    LOOP
    INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
    END LOOP;
    END;
    /

    CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
    CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
    CREATE OR REPLACE PROCEDURE APP_DATA.INSERTEMP (pp in tbl_survey,result out varchar)
    IS
    BEGIN
    FOR I IN pp.FIRST .. pp.LAST
    LOOP
    INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
    END LOOP;
    result:='done';
    END;
    public static void passArray() throws SQLException
         Connection conn=null;
         try{
              conn=getOracleConnection();//this method returns connection object
         catch (Exception e)      
              e.printStackTrace();
         String[][] val=new String[2][2];
    *     val[0][0]="1";*
    *     val[0][1]="aaa";*
    *     val[1][0]="2";*
    *     val[1][0]="bbb";*
    StructDescriptor desc1=StructDescriptor.createDescriptor("TYPE_SURVEY",conn);
    STRUCT p1struct1 = new STRUCT(desc1,conn,_val_); *//showing error at this line*
    ArrayDescriptor arraydesc = ArrayDescriptor.createDescriptor("TBL_SURVEY",conn);
    ARRAY array = new ARRAY(arraydesc,conn,*p1struct1*);
    CallableStatement cstmt = conn.prepareCall("{ call INSERTEMP(?,?)}");
    cstmt.setObject(1,array);
    cstmt.registerOutParameter(2, OracleTypes.VARCHAR);
    cstmt.execute();
    String res=cstmt.getString(2);
    System.out.println(res);
    in the above java code, I have passed 2d array of string to STRUCT constructor and passed STRUCT object i.e. p1struct1  to ARRAY constructor. is it correct? that means @bottom line, I want to pass val array to my stored porcedure. How can i do this? above code is showing following error......
    Exception in thread "main" java.sql.SQLException: Fail to convert to internal representation: [Ljava.lang.String;@146c1d4
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
         at oracle.jdbc.oracore.OracleTypeNUMBER.toNUMBER(OracleTypeNUMBER.java:540)
         at oracle.jdbc.oracore.OracleTypeNUMBER.toDatum(OracleTypeNUMBER.java:54)
         at oracle.sql.StructDescriptor.toOracleArray(StructDescriptor.java:717)
         at oracle.sql.StructDescriptor.toArray(StructDescriptor.java:1375)
         at oracle.sql.STRUCT.<init>(STRUCT.java:159)
         at com.flologic.ArrayDemo.passArray(ArrayDemo.java:29)
         at com.flologic.ArrayDemo.main(ArrayDemo.java:57)

  • Pass complex types from Java to C++

    Hi,
    I am new to JNI and I read some online documentation. I was wondering how difficult it is to pass complex Java types to C++ functions. I guess I need to map the Java class to a C++ class somehow. I could not find any useful examples that do this. For example, I have the Java classes:
    class SomeClassA
       double someFieldA;
    class SomeClassB
       ArrayList<SomeClassA> collA;
       double someFieldB;
    }Now I would like to map this to the following C++ class:
    class some_class_a
      double _some_field_a;
    class some_class_b
      vector<some_class_a> _coll_a;
      double _some_field_b;
    };I do not need to access Java objects from my C++, I just want the objects to be "serialized" into C++ objects.
    Is there an example that does something like this? Or should I use something different than JNI?
    Thank you,
    Andrej

    I do not need to access Java objects from my C++, I just want the objects to be "serialized" into C++ objects.Then you need to access java objects.
    Is there an example that does something like this? Write java code to access the data of the object (and via that the sub collection).
    That code represents exactly the same thing that you must do in JNI calls in your C code. Naturally excluding populating the C structures themselves of course. Most a matter of calling methods and accessing attributes. That is all in the JNI docs and there are plenty of examples of both of those.

  • Can't transfer date type from java proxy to XI

    I 'm using Java proxy send message to XI&#12290;
    but some element for Date type didn't transfered to XI.
    XI 3.0
    I have tried  notes:719010.

    I have the same exact problem after more than year with no problem... Please help meI didn't install new firmware since I have the player I have the .40 version?thanks

  • Reading data from Table type from Badi /sapapo/curto_create

    Hi,
    I have been trying to read data from badi /sapapo/curto_create . In this badi there is method CS_PPDS_RTO.
    which has nested structure upto 8 level. I have been trying to read data but i am not suceesfull in reading data from the stsructre
    which is present at lowest level.
    The  nested structure of the BEFORE_SAVE is following way.
    BEFORE_SAVE-CS_PPDS_RTO-HIRARCHY-ADD_APPLICTN_DATA-MODES-BODY-CAP_REQS-RESUID.
    I have to read the value of reusid bt i am not sure whow to read this value can you please help me by giving some Bapi or method
    to read the value of Reusid .
    Thanks

    Hi!
    DATA: lv_resuid TYPE resuid.
    LOOP AT CS_PPDS_RTO-HIRARCHY-ADD_APPLICTN_DATA-MODES-BODY-CAP_REQS-RESUID
    INTO lv_resuid.
    ENDLOOP. 

  • Passing a structure from Java to PL/SQL Procedure

    Environment: Oracle DB, Tomcat/Apache
    How do we pass a structure (Table Record Type) from Java to a PL/SQL Stored Procedure?
    We are doing JSP-->JavaClass/Bean to communicate to DB. We have an existing PL/SQL packages/Procedure to insert records into table (These procedures have record types as in/out parameters). So is there a way to call these from Java?
    Thanks in advance.
    Ramesh

    Oracle9 i JDBC Developers Guide and Reference(page 21-16):
    It is not feasible for Oracle JDBC drivers to support calling arguments or return
    values of the PL/SQL RECORD, BOOLEAN, or table with non-scalar element types.
    However, Oracle JDBC drivers support PL/SQL index-by table of scalar element
    types. For a complete description of this, see "Accessing PL/SQL Index-by Tables"
    on page 16-21.
    As a workaround to PL/SQL RECORD, BOOLEAN, or non-scalar table types, create
    wrapper procedures that handle the data as types supported by JDBC. For example,
    to wrap a stored procedure that uses PL/SQL booleans, create a stored procedure
    that takes a character or number from JDBC and passes it to the original procedure
    as BOOLEAN or, for an output parameter, accepts a BOOLEAN argument from the
    original procedure and passes it as a CHAR or NUMBER to JDBC. Similarly, to wrap a
    stored procedure that uses PL/SQL records, create a stored procedure that handles
    a record in its individual components (such as CHAR and NUMBER) or in a structured
    object type. To wrap a stored procedure that uses PL/SQL tables, break the data
    into components or perhaps use Oracle collection types.

  • How to move a money value from java to Flex

    According to
    http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDo cs_Parts&file=00001103.html
    I can pass a Double, Float, Long, Short, BigDecimal or the primative equivalent types from java to Flex and they will be converted into a number.
    My testcase says that only BigDecimal actually shows up on the Flex side.
    Am I missing something or is there a problem in BlazeDs/Flex somewhere?
    Bill Tims
    P.S. If you would like my sample code, I'll be glad to post it.

    Pete
    After looking at it I see why you were confused. Here is the Java object, the receiving Flex object, and the debug info from the SystemOut.log out of JBos 4.2. All of this is using Java 1.6 and Flex 3.0. I'm using the December, 2008 BlazeDs jar files.
    The variable bCd is being serialized as BCd. If I change it to bcd, everything works fine. We also tested this with php->flex and that works fine, which suggests the problem is in Blaze.
    public class Test2 implements Serializable{
    private static final long serialVersionUID = 1805176418478176484L;
    private String abc = "abc";
    private String bCd = "bcd";
    public Test2() {
    public String getAbc() {
    return abc;
    public void setAbc(String abc) {
    this.abc = abc;
    public String getBCd() {
    return bCd;
    public void setBCd(String cd) {
    bCd = cd;
    ============================================================
    package jdbcTables.businessdelegate {
    import mx.rpc.soap.types.*;
    import org.slsot.mis.jdbc.*;
    [RemoteClass(alias="org.slsot.mis.value.inquiry.Test2")]
    [Bindable]
    public class Test2
    public var abc:String;
    public var bCd:String;
    } /* Test2*/
    =============================================================
    12:24:22,084 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:22.084 [Endpoint.General] Channel endpoint slsot-amf received request.
    12:24:22,084 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:22.084 [Endpoint.AMF] Deserializing AMF/HTTP request
    Version: 3
    (Message #0 targetURI=null, responseURI=/4)
    (Array #0)
    [0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')
    operation = "callFunction"
    source = null
    destination = "accessor"
    timestamp = 0
    headers = (Object #1)
    DSEndpoint = "slsot-amf"
    DSId = "nil"
    clientId = null
    timeToLive = 0
    messageId = "9530B236-243F-4965-4252-CD944C3430F1"
    body = (Array #2)
    [0] = "Test"
    [1] = "test2"
    [2] = (Array #3)
    12:24:22,084 DEBUG [Accessor]-btims Begin Test.test2()
    12:24:22,099 DEBUG [Security]-btims t2=org.slsot.mis.value.inquiry.Test2@1b89df3
    12:24:24,678 DEBUG [Accessor]-btims End Test.test2()
    12:24:24,678 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:24.678 [Service.Remoting] Adapter 'java-object' called 'org.slsot.mis.Accessor.callFunction(java.util.Arrays$ArrayList (Collection size:3)
    [0] = Test
    [1] = test2
    [2] = java.lang.Object[] (Array length:0)
    12:24:24,693 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:24.693 [Service.Remoting] Result: 'org.slsot.mis.value.inquiry.Test2
    abc = abc
    BCd = bcd
    12:24:24,693 INFO [STDOUT]-btims [BlazeDS]03/03/2009 12:24:24.693 [Endpoint.AMF] Serializing AMF/HTTP response
    Version: 3
    (Message #0 targetURI=/4/onResult, responseURI=)
    (Externalizable Object #0 'DSK')
    (Typed Object #1 'org.slsot.mis.value.inquiry.Test2')
    abc = "abc"
    BCd = "bcd"
    1.236104664693E12
    (Byte Array #2, Length 16)
    (Byte Array #3, Length 16)
    (Byte Array #4, Length 16)

  • 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);

Maybe you are looking for