help topic表,以字元拆分,一行轉多行

2021-10-01 16:41:38 字數 1031 閱讀 8938

**:

help_topic表是資料庫mysql下的乙個表

substring_index(s, delimiter, number)
返回從字串 s 的第 number 個出現的分隔符 delimiter 之後的子串。

1、如果 number 是正數,返回第 number 個字元左邊的字串。

select substring_index('a*b*c*d*e','*',3);    ---- a*b*c
1、如果 number 是負數,返回第(number 的絕對值(從右邊數))個字元右邊的字串。

select substring_index('a*b*c','*',-1);    ---- c

select substring_index(substring_index('a*b*c*d*e','*',3),'*',-1); ---- c

示例:

以特定格式拆分日期

1.將給定字串解析成date格式 呼叫 dateformat類的parse 引數是string型別,返回值為date型別。如下 string str1 07月08日1900年 dateformat dateformat new dateformat mm月dd日yyyy年 date date dat...

oracle如何拆分以逗號分隔的字串為多行

最近遇到乙個問題,需要把乙個帶有,的字串拆分成多行。通過查詢資料,這個操作需要使用以下2個關鍵知識 1.regexp substr函式 這個函式的作用是正則分隔字串,用法為 function regexp substr string,pattern,position,occurrence,modif...

oracle如何拆分以逗號分隔的字串為多列

最近遇到乙個問題,需要把乙個帶有,的字串拆分成多列。通過查詢資料,這個操作需要使用以下2個關鍵知識 1.regexp substr函式 這個函式的作用是正則分隔字串,用法為 function regexp substr string,pattern,position,occurrence,modif...