Reputation: 47
i have a column DBNAME where the values can be as follows:
ORCLDBhostone1
ORCLDBhosttwo2
ORCLDBhostthree3
ORCLDBhostfour4
ORCLDBhost
Here 1,2,3,4 are the instance numbers,in RAC databases.And if there is no number at the end then it is a standalone database,and doesnt need any truncation.
How can i remove the last character,but only if it is in between 1-6. Please suggest.Thanks.
Upvotes: 0
Views: 81
Reputation: 1269493
You can use regexp_replace()
:
regexp_replace(col, '[1-6]$', '')
Upvotes: 1