netraider
netraider

Reputation: 257

Remove first characters of string in Oracle Server

I have Table1.column1 in a Oracle Server with text such as 12345678910.

How can I remove the first six characters of the string? The result should be 78910.

Upvotes: 8

Views: 49336

Answers (3)

If you know you want the last five characters of a string you can use a negative value for the second argument to SUBSTR, as in:

select substr('12345678910', -5) from dual;

which produces '78910'.

Best of luck.

Upvotes: 6

MT0
MT0

Reputation: 168796

SELECT SUBSTR( column1, 7, LENGTH( column1 ) - 6 )
FROM   Table1;

or more simply:

SELECT SUBSTR( column1, 7 )
FROM   Table1;

Upvotes: 15

Rahul
Rahul

Reputation: 77934

Have you tried using SUBSTR() function like

select substr(column1, 6, 5)
from Table1;

Upvotes: 1

Related Questions