この文字列で検索してください:
SELECT SUBSTR(vendor_name,
INSTR(vendor_name, ' ', 1, 1) + 1,
INSTR(vendor_name, ' ', 1, 2) - INSTR(vendor_name, ' ', 1, 1) - 1)
FROM vendors
ORDER BY vendor_id
これがどのように機能するかを確認するには、ここでは例Boeing Corporation Inc.
のvendor_name
を取る:
INSTR(vendor_name, ' ', 1, 1) = 7 = first occurrence of space
INSTR(vendor_name, ' ', 1, 2) = 19 = second occurrence of space
は今ここにあります部分文字列にする呼び出し:
私の答えは
vendor_name
(また、第一の空間)に存在する第二の領域があることを前提とし
SELECT SUBSTR('Boeing Corporation Inc.', 8, 11) = 'Corporation'
注同じである
SELECT SUBSTR('Boeing Corporation Inc.',
7 + 1,
19 - 7 - 1)
。この列に複雑なデータがある場合は、代わりに正規表現を使用することをお勧めします。
regexp_substrはsubstrとinstrよりもはるかに優れています – OscarAkaElvis