Hi Craig,
I'm having a problem with jdbc creating a nested object table in 
oracle8i.

eg in oracle 8i, you create the object table using this code :

create  type phone_number  as Object
(phone_no varchar2(12),
  phone_type   char(1));

create type  all_phones  as table of phone_number;

// now create the nested table :
               
create table cust_phones
( cust_no   varchar2(8),
cust_name  varchar2(20),
phone_nos  all_phones)
nested table phone_nos  store as all_phones_nst;


insert into cust_phones values ('joey123','joey smith', all_phones()); 
is a query which works fine in oracle sql plus. It will put null values 
into the nested table all_phones. Which is exactly what I want.

But trying to run it from a java class through jdbc, like this :

String sql = "INSERT INTO CUST_PHONES VALUES (?,?,?);";
                                        
                        PreparedStatement pstmt = null;
                pstmt = conn.prepareStatement(sql);

                        pstmt.setString(1, "joey123");

                        pstmt.setString(2, "joey smith");

                        pstmt.setNull(3, java.sql.Types.STRUCT, "all_phones");


will give an error like this :
java.sql.SQLException: ORA-00911: invalid character

Let me know if you have any idea on how to fix this jdbc problem. 
If I use a regular stmt.execute(sql), it works fine and puts the null 
values into the table. Thanks in advance for your help.

  

Reply via email to