Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Add the SUBSTRING alias for the SUBSTR function

iwisDec 30 2020 — edited Apr 15 2021

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 the SUBSTRING alias for the SUBSTR function.
Explanation: This is the current syntax of the SUBSTR[ING] functions in ANSI standard and in different RDBMS:

ANSI standard:      SUBSTRING   (s FROM start [FOR length])
PostgreSQL & MySQL: SUBSTR[ING] (s, start [,length])
Oracle & SQLite:    SUBSTR      (s, start [,length])
SQL Server:         SUBSTRING   (s, start  ,length )

To unify the syntax, I propose to add the SUBSTRING alias to the SUBSTR function in Oracle. SQLite already will support the SUBSTRING alias from the 3.34 version. If Oracle does the same, we will be able to use the SUBSTRING(s, start, length) syntax in all above-mentioned RDBMS. This will make the SQL Server syntax compatible with all major RDBMS. Hopefully this would be another step to help C# programmers switch from SQL Server to other databases. I think it is worth to think about it, especially after the latest release of the .NET 5 framework, which unifies the old .NET Framework and .NET Core, into the single multi-platform framework able to be run on Windows and Linux.
I also proposed this change: https://community.oracle.com/tech/developers/discussion/4477917/proposal-add-an-optional-argument-c-after-a-comma-in-the-trim-s-function.
The changes proposed by me for other RDBMS are listed here: https://github.com/iwis/SQL-notes/blob/master/Functions_proposed_changes.md

Comments
Post Details
Added on Dec 30 2020
0 comments
579 views