code: public long position(final byte[] pattern, final long start) throws SQLException {
      if (start < 1) {
        throw ExceptionMapper.getSqlException("Start should be > 0, first position is 1.");
      }
      if (start > this.length) {
        throw ExceptionMapper.getSqlException("Start should be <= " + this.length);
      }
      final long actualStart = offset + start - 1;
      for (int i = (int) actualStart; i < offset + this.length; i++) {
        if (data[i] == pattern[0]) {
          boolean isEqual = true;
          for (int j = 1; j < pattern.length; j++) {
            if (i + j >= offset + this.length) {
              return -1;
            }
            if (data[i + j] != pattern[j]) {
              isEqual = false;
            }
          }
          if (isEqual) {
            return i + 1 - offset;
          }
        }
      }
      return -1;
    }
docs: Retrieves the byte position at which the specified byte array <code>pattern</code> begins
  within the
  <code>BLOB</code> value that this <code>Blob</code> object represents.  The search for
  <code>pattern</code>
  begins at position <code>start</code>.
  
  @param pattern the byte array for which to search
  @param start   the position at which to begin searching; the first position is 1
  @return the position at which the pattern appears, else -1