Link to home
Start Free TrialLog in
Avatar of Wilder1626
Wilder1626Flag for Canada

asked on

Oracle - Query pull string up to a specific character

Hi,

I have this query that i would like to modify but i don't know how.

Select Description from Comment_T

Open in new window


In the Description field, i have value like: TT_MB_1. TT_CC_6, TT_FF_9 etc...

I would like to get everything from the string up to the last underscore "_".
Ex: If i have TT_MB_1, it would give me "TT_MB_".

How can i do that?

Thank you for your help
Avatar of Darrell Porter
Darrell Porter
Flag of United States of America image

INSTR('TT_MB_1. TT_CC_6, TT_FF_9', '_', -1)
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wilder1626

ASKER

Thank you for your help. This is exactly what i needed.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ho!!! you are correct, sorry, i actually took that one:
select substr(description,1,instr(description,'_',-1)) from comment_t

Open in new window