Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL statement to remove all charaters after last hyphen in a string

user13773050Jul 6 2016 — edited Jul 6 2016

I need to be able to remove all characters after the last hyphen in a string (including the hypen).

Example data would be similar to -> COMPUTER-LOAN-WEST

                                                          COMPUTER-LOAN-SOUTH

                                                          COMPUTER-LOAN-NORTH

                                                           COMPUTER-LOAN-CANADA

Output of select statement should be -> COMPUTER-LOAN

Only data after the last hyphen should ever be removed.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2016
Added on Jul 6 2016
11 comments
4,313 views