Skip to Main Content

Oracle Database Discussions


For appeals, questions and feedback, please email

Add an optional argument c after a comma in the TRIM(s) function

iwisDec 30 2020 — edited Apr 15 2021

I compared string functions in 5 different RDBMS: PostgreSQL, MySQL, Oracle, SQL Server and SQLite, and also in the ANSI SQL Standard. There are large differences among different RDBMS, and I propose to reduce them a little bit.
Particularly, I propose to add an optional argument c after a comma in the TRIM(s) function (the space ' ' by default).
Explanation: We can now call the following functions in Oracle:

LTRIM(s [,c])
RTRIM(s [,c])
TRIM (s)

As you see, we can pass the argument c after the comma in the LTRIM and RTRIM functions, but not in the TRIM function, which is strange. For the TRIM function we have to use the SQL ANSI Standard syntax: TRIM(c FROM s). On the other hand, in PostgreSQL and SQLite calling TRIM(s, c) is possible. So this difference between different RDBMS and the difference in Oracle itself between the LTRIM/RTRIM(s [,c]) and TRIM(s) functions seem to be unjustified. Or maybe somebody knows a justification?
I also proposed this change:
The changes proposed by me for other RDBMS are listed here:

Post Details
Added on Dec 30 2020
1 comment