Oracle LTRIM function
Description
The Oracle LTRIM() function is used to remove all specified characters from the left end side of a string. By default, it removes leading spaces, but you can specify other characters to trim.
Uses of Oracle LTRIM Function
- Removing Leading Spaces: Cleans up strings by removing unwanted leading spaces.
- Trimming Specific Characters: Removes specified characters from the left side of a string.
- Cleaning Data Inputs: Ensures data consistency by trimming unwanted leading characters.
- Standardizing Data Formats: Prepares data by removing extraneous leading characters.
- Preparing Data for Storage: Cleans up data before storing it in the database.
- Formatting User Inputs: Ensures user inputs are free from leading unwanted characters.
Syntax:
LTRIM(string1 [, set ])
Parameters :
Name | Description | Data Types |
---|---|---|
string1 | The string to trim the characters from the left-hand side. | CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB |
set (optional) | String which is used for trimming. | CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB |
Return Value Type
VARCHAR2
Applies to
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
Pictorial Presentation
Examples: Oracle LTRIM function
Here are some Oracle LTRIM function examples :
SQL> SELECT LTRIM(' w3r') "Str" FROM DUAL;
Str
---
w3r
SQL> SELECT LTRIM(' w3r ') "Str" FROM DUAL;
Str
------
w3r
SQL> SELECT LTRIM('000985','0') "Str" FROM DUAL;
Str
---
985
SQL> SELECT LTRIM('0101985','01') "Str" FROM DUAL;
Str
---
985
SQL> SELECT LTRIM('125486W3R','0123456789') "Str" FROM DUAL;
Str
---
W3R
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/oracle/character-functions/oracle-ltrim-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics