title: Read Blob from PL/SQL through Spring
body: <p>I am trying to retrieve a Blob value thorugh PL/SQL, Spring and JDBC. </p>
  
  <p>Here is my PL/SQL</p>
  
  <pre><code>function GETBLOB(pjobid in number)
  RETURN bobrecCur
  is
  vbobrecCur bobrecCur;
  begin
     OPEN vbobrecCur FOR
     SELECT jobid, filecontent
     FROM TESTBULKJOBDATAFILE
     WHERE jobid = pjobid;
     RETURN vbobrecCur;
  end GETBLOB
  </code></pre>
  
  <p>And my Java code is</p>
  
  <pre><code>this.getDataJdbcCall =
              new SimpleJdbcCall( this.jdbcTemplate )
                      .withFunctionName(  SQL_READ_DATA )
                      .withoutProcedureColumnMetaDataAccess()
                      .declareParameters(
                              new SqlOutParameter( "abc", OracleTypes.CURSOR ),
                              new SqlParameter( "pjobid", OracleTypes.INTEGER )
                      );
  
  Map input = new HashMap();
      input.put( "pjobid", 99999 );
  
      ResultSet result = this.getDataJdbcCall.executeFunction(ResultSet.class , input );
      DefaultLobHandler lob =  new DefaultLobHandler();
      InputStream is = lob.getBlobAsBinaryStream( result, 1 );
  </code></pre>
  
  <p>I am getting the following exception.. basically saying that Resultset is null. </p>
  
  <p>Exception in thread "main" java.lang.NullPointerException
      at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:91)
      at org.springframework.jdbc.core.JdbcTemplate.processResultSet(JdbcTemplate.java:1120)
      at org.springframework.jdbc.core.JdbcTemplate.extractOutputParameters(JdbcTemplate.java:1089)
      at org.springframework.jdbc.core.JdbcTemplate$5.doInCallableStatement(JdbcTemplate.java:996)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:935)
      at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:984)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:364)
      at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:349)
      at org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:137)</p>
  
  <p>I went through <a href="https://stackoverflow.com/questions/1474456/reading-a-blob-using-jdbc-spring-without-a-result-set">this</a> question which should work for me.  But I think the way I am using OracleLobHandler is not right.</p>
  
  <p>Can anybody shed any light on where I am going wrong?</p>