I'm trying to get the file handle from plsq, I'm trying to see if I can test plsql packages from Java I have this code:
Properties props = Utils.readProps("database.properties");
Connection con = DBManager.getConnection(props.getProperty("url"), props.getProperty("username"), props.getProperty("password"));
Object file_type = new Object[3];
STRUCT oracleRecord;
try {
//StructDescriptor fileType = StructDescriptor.createDescriptor("UTL_FILE.FILE_TYPE",con);
CallableStatement stmt = con.prepareCall("{call simple_test.caller(?,?,?)");
stmt.setObject(1, "/u01/home/oracle/EI/278");
stmt.setObject(2, "ql_item_test.txt");
stmt.registerOutParameter(3, OracleTypes.STRUCT, "UTL_FILE.FILE_TYPE");
stmt.execute();
oracleRecord = ((OracleCallableStatement)stmt).getSTRUCT(3);
file_type = oracleRecord.getAttributes();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
And this plsql code:
PROCEDURE caller(file_path VARCHAR2,
file_name VARCHAR2,
fp OUT UTL_FILE.file_type) IS
maxLineSize INTEGER;
BEGIN
maxLineSize := 1024;
fp := UTL_FILE.FOPEN(file_path, file_name, 'R', maxLineSize);
END;
But When I ran it I guess this error:
java.sql.SQLException: invalid name pattern: UTL_FILE.FILE_TYPE
I'm I getting this error because I can't pass/retrieve plsql types?