title: Mysql split_str function is returning empty value if delimiter is not exists in the column value
body: <p>I am using following user defined mysql function,</p>
  
  <pre><code>CREATE FUNCTION SPLIT_STR(
    x VARCHAR(255),
    delim VARCHAR(12),
    pos INT
  )
  RETURNS VARCHAR(255)
  RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
         CHAR_LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
         delim, '');
  
  
  `select split_str(‘1||john’,'||’,2);` - result "john".
  </code></pre>
  
  <p>But this function is not working if the column value is not having delimiter string(||)</p>
  
  <pre><code>select split_str(‘john’,'||’,2); - required result john.
  </code></pre>
  
  <p>But I am getting empty value. Please give any suggestion</p>