Professional Documents
Culture Documents
Collection
Collection
Function created.
---------------------------------------------------------------------------------------------------Java:
---------------------------------------------------------------------------------------------------import java.sql.*;
import oracle.jdbc.*;
import oracle.sql.*;
public class ArrayTest {
public static void main(String[] args) throws SQLException {
DriverManager.registerDriver(new OracleDriver());
OracleConnection connection = (OracleConnection) DriverManager.getConnec
tion(...);
String[] elements = {"abc", "def", "geh"};
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("STRING_AR
RAY", connection);
ARRAY array = new ARRAY(descriptor, connection, elements);
OracleCallableStatement stmt = (OracleCallableStatement) connection.prep
areCall("{? = call to_string(?)}");
stmt.registerOutParameter(1, Types.VARCHAR);
stmt.setARRAY(2, array);
stmt.execute();
String result = stmt.getString(1);
System.out.println("to_string returned: " + result);
}
}