Announcement Announcement Module
Collapse
No announcement yet.
pass an array of SqlLobValue to an Oracle stored procedure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • pass an array of SqlLobValue to an Oracle stored procedure

    Hello,

    I'm trying to send an array of SqlLobValue to a stored procedure and I receive the following error:
    Code:
    Fail to convert to internal representation: org.springframework.jdbc.core.support.SqlLobValue	
    .....
    at oracle.jdbc.oracore.OracleTypeBLOB.toDatum(OracleTypeBLOB.java:62)
    	at oracle.jdbc.oracore.OracleType.toDatumArray(OracleType.java:129)
    	at oracle.sql.ArrayDescriptor.toOracleArray(ArrayDescriptor.java:999)
    	at oracle.sql.ARRAY.<init>(ARRAY.java:133)
    here are the code snippets related

    I have created a collection type in Oracle:
    Code:
    CREATE OR REPLACE TYPE ct_blob AS TABLE OF BLOB;
    And I have the following java classes:
    Code:
    public class UpdateSupportInfo extends StoredProcedure {
    	private LobHandler lobHandler;
    
    	public void setLobHandler(LobHandler lobHandler) {
            this.lobHandler = lobHandler;
        }
    	
    	UpdateSupportInfo (){
    		declareParameter(new SqlParameter("pi_support_info_id", Types.BIGINT));
            declareParameter(new SqlParameter("pi_support_documents", Types.ARRAY, "TS.CT_BLOB"));
    	}
    
    	public MessageInfo execute(SupportInfo supportInfo){
    		Map in = new HashMap();
            in.put("pi_support_info_id", supportInfo.getSupportInfoId());
            in.put("pi_support_documents", new OracleArraySqlTypeValue(getDocs(supportInformation)));
            Map out = execute(in);
            return getMessageInfo(out);
    	}
    	
    	private SqlLobValue[] getDocs(SupportInfo supportInfo){
    		int docsLength = supportInfo.getSupportDocuments().length;
    		SqlLobValue[] attachDocs = new SqlLobValue[docsLength];
    		for(int i = 0; i < docsLength; i++){
    			attachDocs[i] = new SqlLobValue(supportInfo.getSupportDocuments()[i].getSupportDocumentContent(), lobHandler);
    		}
    		
    		return attachDocs;
    	}
    Has anyone had a similar experience ?
Working...
X