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!

Trim Suffixes in a column values

530678Dec 7 2007 — edited Dec 7 2007
Hi:

I need to remove multiple suffix values from a column

for instance I have a column like this:

XFPSSYSTEM[b]-XXX
X6554610PDR[b]-P22
6554610PDR-ABCD


and I want remove defined suffixes such as -XXX, -P22, XYZ, etc, etc.

XFPSSYSTEM <-- removed -XXX
X6554610PDR <-- removed P22
6554610PDR-ABCD <-- does not have to remove any thing here

I used this

trim(substr('12345-AKA',1,instr('12345-AKA', '-AKA')-1))

but this only removes one suffix value of -AKA.

Please let me know if you have any ideas.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2008
Added on Dec 7 2007
11 comments
1,351 views