Scroll untuk baca artikel
DatabaseOracle

TRIM function in Oracle

157
×

TRIM function in Oracle

Sebarkan artikel ini
oracle database big
oracle database big

In Oracle / PLSQL, there is a trim () function that is useful for removing a certain character. The default is a blank (or empty space) character.
Simple syntax is as follows:
trim ([leading | trailing | both [trim_character]] trim_source)

The explanation:
leading = remove the trim_character character that is in front of trim_source
trailing = remove the trim_character character that is behind trim_source
both = remove the trim_character character that is in front and behind trim_source
Rule:
– if trim_character is not defined, the default is blank (blank space)
– if only trim_source is defined, then the default is both with trim_character as blank
– if trim_source is NULL, then this function will return NULL
Example:

ELECT TRIM('ASF') FROM DUAL;	will return 'ASF'
SELECT TRIM('' from 'ASF') FROM DUAL;	will return 'ASF'
SELECT TRIM(leading '' from 'ASF') FROM DUAL;	will return 'ASF'
SELECT TRIM(trailing '' from 'ASF') FROM DUAL;	will return 'ASF'
SELECT TRIM(both '' from 'ASF') FROM DUAL;	will return 'ASF'

 

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

Situs ini menggunakan Akismet untuk mengurangi spam. Pelajari bagaimana data komentar Anda diproses.

Verified by MonsterInsights