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
.
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.
To delete the first characters from the field we will use the following query: Syntax: SELECT SUBSTRING(string, 2, length(string));
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.
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.
SELECT SUBSTR( column1, 7, LENGTH( column1 ) - 6 )
FROM Table1;
or more simply:
SELECT SUBSTR( column1, 7 )
FROM Table1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With