Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove first characters of string in Oracle Server

Tags:

oracle

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.

like image 320
netraider Avatar asked Jan 20 '16 00:01

netraider


People also ask

How do you remove the first character of a string in Oracle?

If you must remove characters only from the front of the string, use SUBSTR without a third argument (you don't need to worry about length and such) - by default, SUBSTR starts from the indicated starting position and reads all the way to the end of the string.

How do I remove the first character from a string in SQL Server?

To delete the first characters from the field we will use the following query: Syntax: SELECT SUBSTRING(string, 2, length(string));

What is Ltrim and Rtrim in Oracle?

The Oracle LTRIM function will remove a specified character from the left side of a string. The L in LTRIM stands for “Left”, and is the opposite of the RTRIM or “Right” Trim function. Finally, the Oracle RTRIM function removes a specified character from the right side of a string.

How does Oracle Ltrim work?

LTRIM removes from the left end of char all of the characters contained in set . If you do not specify set , it defaults to a single blank. If char is a character literal, then you must enclose it in single quotes.


1 Answers

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

or more simply:

SELECT SUBSTR( column1, 7 )
FROM   Table1;
like image 83
MT0 Avatar answered Jan 30 '23 10:01

MT0