Oracle 12CでINSTR関数を使用して文字列の位置を求める

環境
Oracle Database 12c Standard Edition Release 12.2.0.1.0 – 64bit Production

構文
INSTR(word, target [, N [, M] ] )
wordで指定した文字列からtargetを検索して、位置を求めます。Nを指定している場合はN番目の文字から検索を開始します。
Mを指定している場合はM番目に検索されるtargetの位置を返します。

使用例
メールアドレスの@の位置を求めます。
SQL構文

SELECT
  INSTR('contact@arkgame.com', '@') result 
FROM
  dual;

結果 8

Oracle 12c

Posted by arkgame