Oracle Substr SQL -
i got list of database.
**name** oee_line_abc oee_line_abcd oee_line_qwertyuiop oee_line_zxcvbd
i need grab name
after oee_line_
. not standardize how many characters. google fix how many characters.
example :
substr(name,10,3) result: 'abc'
if use above substr, able grab 1st value (oee_line_abc
) without problem, when comes 2nd value, there's problem because above substr can retrieve 3 characters.
expected result:
the sql statement able grab values after oee_line_
result(return name without oee_line_
):
name = abc name = abcd name = qwertyuiop name = zxcvbd
any related post share , answer?
i suggest looking last '_
' , taking string there:
select substr(name, length(name) - instr(reverse(name), '_') + 2)
Comments
Post a Comment