溫馨提示×

oracle中substr的用法是什么

小云
116
2023-08-25 16:39:01
欄目: 云計算

在Oracle中,SUBSTR函數用于從字符串中提取子字符串。

語法:

SUBSTR(string, start_position, [length])

參數說明:

  • string:要提取子字符串的字符串。

  • start_position:指定開始提取的位置,從 1 開始計數。

  • length:可選參數,指定要提取的子字符串的長度。如果省略該參數,則提取從 start_position 開始到字符串末尾的所有字符。

示例:

  1. 提取字符串中的子字符串:

SELECT SUBSTR(‘Hello World’, 7) FROM dual;

結果:‘World’

  1. 提取字符串中指定長度的子字符串:

SELECT SUBSTR(‘Hello World’, 7, 5) FROM dual;

結果:‘World’

  1. 提取字符串中指定長度并在開始位置偏移的子字符串:

SELECT SUBSTR(‘Hello World’, 7, 3) FROM dual;

結果:‘Wor’

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女