SELECT POSITION('ab' IN 'abcde') AS position
FROM dual;
SELECT POSITION('ab' INSTR('abcde', 'ab') - 1) AS position
FROM dual;
SELECT REGEXP_INSTR('abcde', 'b') AS position
FROM dual;
SELECT CASE WHEN POSITION('ab' IN 'abcde') > 0 THEN POSITION('ab' IN 'abcde') ELSE 0 END AS position
FROM dual;
SELECT SUBSTR('abcde', POSITION('b' IN 'abcde'), 2) AS substring
FROM dual;
通過合理使用這些技巧,可以更有效地利用 Oracle 的 POSITION 函數來實現字符串操作。