Reputation: 1426
probably this is an easy one but I need your help.
I have a table with data like these:
NAME VAL1
135.name1 value1
135.name2 value2
135.name3 value3
If I wanted to select the data in the column NAME I would do something like this:
select s.NAME
FROM MY_TABLE s
where s.SCHEDULE_NAME like '135.%'
NAME
135.name1
135.name2
135.name3
But I want to select the data in column NAME but without the '135.'
Notice that 135 is not a constant. It can be for example '34567.'. So it can be more digits.
Is it possible? I like to get this:
NAME
name1
name2
name3
Upvotes: 3
Views: 86
Reputation: 172418
You are probably looking for this:-
SELECT REGEXP_REPLACE('135.name1', '^135.') FROM Table;
and for your case:-
SELECT REGEXP_REPLACE(name, '^135.') FROM My_Table;
or try this:-
SELECT REPLACE('135.name1','135.','') COL1 FROM Table;
EDIT:-
To make it more dyanamic you may try this:-
SELECT REGEXP_REPLACE(name, '^\d+\.') FROM My_Table;
Upvotes: 2