我希望调用一个oracle函数,它接受oracle类型的参数类型和oralce类型的一个out参数类型。
代码:
Connection connection = (Connection) parameters.get(SwingBenchTask.JDBC_CONNECTION);
boolean success = true;
// getObjArray returns one object array with values
Object[] object2Values = getObjArray("input.txt");
oracle.sql.StructDescriptor structDesc = oracle.sql.StructDescriptor.createDescriptor(typeName, connection);
oracle.sql.STRUCT object1 = new oracle.sql.STRUCT(structDesc, connection, object2Values);
String query = "{call ? :=change_offer(?,?)}";
CallableStatement stmt = connection.prepareCall(query);
long executeStart = System.nanoTime();
try
{
stmt.registerOutParameter(1, OracleTypes.NUMBER);
stmt.setObject(2, object1, OracleTypes.STRUCT);
stmt.registerOutParameter(3, OracleTypes.STRUCT, OutTypeName);
stmt.execute();
stmt.close();
} catch (Exception ex)
{
success = false;
System.err.println("Error :" + ex);
}类oralce.sql.STRUCT的构造函数引发以下异常
java.sql.SQLException: ORA-01427:单行子查询返回多行。
发布于 2011-10-21 09:43:04
我修正了错误。我给类型名加上架构名。
oracle.sql.StructDescriptor structDesc = oracle.sql.StructDescriptor.createDescriptor(schema.typeName, connection);
oracle.sql.STRUCT object1 = new oracle.sql.STRUCT(structDesc, connection, object2Values);https://stackoverflow.com/questions/7832177
复制相似问题