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!

select before last character /

708631Jul 27 2015 — edited Jul 27 2015

I have some urls in a table like so

http://test.com/abc/ghgh.html

http://test.com/bcd/

http://test.com/fff/default.aspx

http:// test2.com/a

I want to select everything before the last /

but if the last / is after the .com then just get it how it is.

so above should result in

http://test.com/abc

http://test.com/bcd

http://test.com/fff

http:// test2.com/a

create table testing2 (

url varchar2(50)

);

insert into testing2 values ('http://test.com/abc/ghgh.html');

insert into testing2 values ('http://test.com/bcd/');

insert into testing2 values ('http://test.com/fff/default.aspx');

insert into testing2 values ('http:// test2.com/a');

This post has been answered by John Stegeman on Jul 27 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2015
Added on Jul 27 2015
6 comments
864 views