By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,935 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

user defined data types

P: 1
Hi
how can I pass a user defined type or array of user defined type to a function?

type:
CREATE TYPE CARDDATARECTYPE AS (DATANAME VARCHAR(256), DATAVALUE VARCHAR(2048), ISDELETABLE SMALLINT )

By oracle jdbc I do this by following:

Expand|Select|Wrap|Line Numbers
  1. StructDescriptor cardStruct = StructDescriptor.createDescriptor("CARDDATARECTYPE",stmt.getConnection());
  2. ArrayDescriptor desc = ArrayDescriptor.createDescriptor("CARDDATARECARRAY",stmt.getConnection());
  3. Object[] arr = new Object[datas.length];
  4. for (int i = 0; i < this.datas.length; i++) {
  5.   Object[] cardData = {datas[i].getName(), datas[i].getValue(), (datas[i].getDeletable() ? "1" : "0")};
  6.         STRUCT p1struct = new STRUCT(cardStruct, stmt.getConnection(), cardData);
  7.         arr[i] = p1struct;
  8.       }
  9.       ARRAY oraArr = new oracle.sql.ARRAY(desc, stmt.getConnection(), arr);
  10.       stmt.setObject(13, oraArr, oracle.jdbc.driver.OracleTypes.ARRAY);
  11.  
thanks alot
Jan 26 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.