Oracle9i SQL Reference Release 1 (9.0.1) Part Number A90125-01 |
|
Functions, 150 of 166
trim::=
trim
TRIM
enables you to trim leading or trailing characters (or both) from a character string. If trim_character
or trim_source
is a character literal, you must enclose it in single quotes.
LEADING
, Oracle removes any leading characters equal to trim_character
.
TRAILING
, Oracle removes any trailing characters equal to trim_character
.
BOTH
or none of the three, Oracle removes leading and trailing characters equal to trim_character
.
trim_character
, the default value is a blank space.
trim_source
, Oracle removes leading and trailing blank spaces.
VARCHAR2
. The maximum length of the value is the length of trim_source
.
trim_source
or trim_character
is a null value, then the TRIM
function returns a null value.
Both trim_character
and trim_source
can be any of the datatypes CHAR
, VARCHAR2
, NCHAR
, NVARCHAR2
, CLOB
, or NCLOB
. The string returned is of VARCHAR2
datatype and is in the same character set as trim_source
.
This example trims leading and trailing zeroes from a number:
SELECT TRIM (0 FROM 0009872348900) "TRIM Example" FROM DUAL; TRIM example ------------ 98723489
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|