1

I am getting a list of StudentIds as a List<String>

I convert that to a String[] later,

String[] studentIdArray = null;
if (list!= null) { // StudentList
 studentIdArray = list.toArray(new String[list.size()]); // printed studentIdArray and print the values. its fine
}

Then an arrayDescriptor is declared to map the Java String[] to the PLSQL Table of RAW which is defined as STUDENT_ID_TYPE

ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor("STUDENT_ID_TYPE", connection);

Now I get the oracle.sql.ARRAY out of it,

ARRAY studentArray = new ARRAY(arrayDescriptor, connection, studentIdArray);

I am unable to find how to print the values in studentArray, although when I print studentArray.length(), it returns as 1, which I feel correct. BUt When this array is passed to my PLSQL procedure, I get custom exception.

edit: when i use the dump(), it just dumps as element[0] = [B@438620c7

1 Answer 1

1

To print the values in studentArray you could first the data as Datum[] then convert the Datum value to String by datum[i].stringValue().

Datum[] datumArr = studentArray.getOracleArray();

for (Datum datum: datumArr)
{
    System.out.println(datum.stringValue());
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.