Versiones comparadas

Clave

  • Se ha añadido esta línea.
  • Se ha eliminado esta línea.
  • El formato se ha cambiado.

...

Bloque de código
languagejava
return jdbcTemplate.execute( new CallableStatementCreator() {

	@Override
	public CallableStatement createCallableStatement( Connection con ) throws SQLException {
		// Definimos la llamada, dejando con ? lo que serán parámetros, tanto de salida como de entrada
		final CallableStatement cs = con.prepareCall( "{ ? = call PAQUETE_BD.METODO(?, ?) }" );

		// Registramos los parámetros de salida
		cs.registerOutParameter( 1, Types.CLOB );

		// Asignamos los parámetros de entrada
		cs.setInt( 2, id);
		cs.setString( 2, texto);

		return cs;
	}
}, new CallableStatementCallback<Reader>() {

	@Override
	public Reader doInCallableStatement( CallableStatement cs ) throws SQLException {
		// Ejecutamos la llamada y devolvemos el valor correspondiente
		cs.execute();
		try {
			return cs.getClob( 1 ).getCharacterStream();
		} catch ( final Exception e ) {
			return null;
		}
	}
} );

...