Use Decode?
I have a table like this
Table Name: CONFIG_STR_T
STR_CODE
----------------
'MBU'
'MBD'
'MBT'
'MIN'
'FRE'
My Requirement: For the rows starting with MB i want the result to be displayed as 'MB' instead of its actual value. For the other records, I want their original values.
REQUIRED OUTPUT:
STR_CODE
----------------
'MB'
'MB'
'MB'
'MIN'
'FRE'
I tried using the following SQL:
select decode(str_code, regexp_like 'MB%', 'MB', str_code) from CONFIG_STR_T;
I am getting error while trying to execute this query. Please let me know which is the best way to get my required output. Also please enlighten on where I went wrong.