Oracle® Database SQL Reference 10g Release 2 (10.2) Part Number B14200-01 |
|
|
View PDF |
Syntax
Purpose
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. Oracle Database begins scanning char
from its first character and removes all characters that appear in set
until reaching a character not in set
and then returns the result.
Both char
and set
can be any of the datatypes CHAR
, VARCHAR2
, NCHAR
, NVARCHAR2
, CLOB
, or NCLOB
. The string returned is of VARCHAR2
datatype if char
is a character datatype and a LOB if char
is a LOB datatype.
Examples
The following example trims the redundant first word from a group of product names in the oe.products
table:
SELECT product_name, LTRIM(product_name, 'Monitor ') "Short Name" FROM products WHERE product_name LIKE 'Monitor%'; PRODUCT_NAME Short Name -------------------- --------------- Monitor 17/HR 17/HR Monitor 17/HR/F 17/HR/F Monitor 17/SD 17/SD Monitor 19/SD 19/SD Monitor 19/SD/M 19/SD/M Monitor 21/D 21/D Monitor 21/HR 21/HR Monitor 21/HR/M 21/HR/M Monitor 21/SD 21/SD Monitor Hinge - HD Hinge - HD Monitor Hinge - STD Hinge - STD