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!

Extract Characters

sliderrulesJun 2 2015 — edited Jun 2 2015

Hi,

I have a table that stores ID as a varchar but includes names alongside the ID. I have a requirement to extract only the value inside the brackets as the ID, see sample data below:

create table test( id varchar2(30),
start_date date)
;

insert into test values('Joe Bloggs (HJUTJFDK)', '09/11/2009');
insert into test values('Someone Else (GFHG JGK)', '09/11/2009');
insert into test values('AGHFJDKK', '09/11/2009');
insert into test values('TRUTIRUT', '09/11/2009');

Expected output:

ID

HJUTJFDK,

GFHG JGK,

'AGHFJDKK',

'TRUTIRUT'

I have tried the following regexp_substr(ID,'[^(]*$') but this returns the close bracket too )

This post has been answered by Frank Kulash on Jun 2 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 30 2015
Added on Jun 2 2015
8 comments
154 views