I have a custom Oracle Type as shown below
CREATE TYPE bank_account AS OBJECT (
ACC_NUMBER(5),
BALANCE NUMBER,
STATUS VARCHAR2(10));
I'm using STRUCT class in JDBC to get the values inside type. I'm able to get the values stored in the type (bank_account) as an ARRAY [54453, 23234, 'ACTIVE'].
But I'm not able to get the object names corresponding to it like "ACC_NUMBER" , "BALANCE" and "STATUS" by any means.
I have seen JPublisher which creates classes corresponding to sql types. But is there any other straight forward way where I can get the META DATA of the object names inside type objects directly in jdbc
Yes, you can use StructDescriptor and ResultSetMetaData classes. I assume that you're calling a stored procedure in Oracle (in my code the first param is an int (IN param) and the second param is a bank_account, which is an OUT param)
The JDBC code
The code should print