Add an optional argument c after a comma in the TRIM(s) function — oracle-tech

    Forum Stats

  • 3,714,551 Users
  • 2,242,575 Discussions
  • 7,844,931 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

iwis
iwis Member Posts: 12 Green Ribbon

Hi!

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: https://community.oracle.com/tech/developers/discussion/4477919/proposal-add-the-substring-alias-for-the-substr-function/.

The changes proposed by me for other RDBMS are listed here: https://github.com/iwis/Scalar-SQL-functions/blob/main/Proposed_changes.md

Sven W.
1 votes

Active · Last Updated

Comments

Sign In or Register to comment.