oracle按特定字符截取字符串 ORACLE怎么拆分字符串?
ORACLE怎么拆分字符串?substr函數(shù)用于分割字符串。例如:字符串是abc123,現(xiàn)在需要截取為ABC和123。從dual function description中選擇substr(“abc1
ORACLE怎么拆分字符串?
substr函數(shù)用于分割字符串。例如:字符串是abc123,現(xiàn)在需要截取為ABC和123。從dual function description中選擇substr(“abc123”,1,3),substr(“abc123”,4,3):substr(“abc123”,1,3),其中abc123是要截取的字符串,1表示從第一位截取,3表示要截取的長度。
Oracle拆分字符串函數(shù)有哪些呢?
從表名中選擇substr(field,1,instr(field,“/”)-1)例如:從helloword中選擇substr(“sdhfuiasdh/asdfsadf”,1,Inst(“sdhfuiasdh/asdfsadf”,“/”)-1
在Oracle中,substr用于截取substr(field name,start position,length)。用于字符串拼接的連接器為“|”。
讓我們寫一個簡單的例子。表中的字段以“2020-10-28”等格式存儲日期?,F(xiàn)在我們只想把年加上中國的“年”。句子如下:
從表名中選擇substr(字段名,1,4)|“year”作為字段別名