code: public long position(final byte[] pattern,
                           long start) throws SQLException {
  
          final byte[] ldata = data;
  
          checkValid(ldata);
  
          final int dlen = ldata.length;
  
          if (start < MIN_POS) {
              throw Util.outOfRangeArgument("start: " + start);
          } else if (start > dlen || pattern == null) {
              return -1L;
          } else {
              start--;
          }
  
          final int plen = pattern.length;
  
          if (plen == 0 || start > dlen - plen) {
              return -1L;
          }
  
          final int  stop = dlen - plen;
          final byte b0   = pattern[0];
  
          outer_loop:
          for (int i = (int) start; i <= stop; i++) {
              if (ldata[i] != b0) {
                  continue;
              }
  
              int     len     = plen;
              int     doffset = i;
              int     poffset = 0;
              boolean match   = true;
  
              while (len-- > 0) {
                  if (ldata[doffset++] != pattern[poffset++]) {
                      continue outer_loop;
                  }
              }
  
              return (i + 1);
          }
  
          return -1L;
      }
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
  @exception SQLException if there is an error accessing the
  <code>BLOB</code> or if start is less than 1
  @exception SQLFeatureNotSupportedException if the JDBC driver does not support
  this method
  @since JDK 1.2, HSQLDB 1.7.2