dbTalk Databases Forums  

Substring or intrstr

comp.database.oracle comp.database.oracle


Discuss Substring or intrstr in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gotosleep
 
Posts: n/a

Default Substring or intrstr - 07-20-2004 , 10:59 AM






I have field that looks like this

Person-12345-(thanks)

I need to select the number in the middle. 12345

Please help...

also the first text PERSON could be any size...

Thank you

Reply With Quote
  #2  
Old   
Philippe Valentin
 
Posts: n/a

Default Re: Substring or intrstr - 07-27-2004 , 11:34 PM






Hello,

I propose the follwing:

SQL> define str1='Person-12345-(thanks)'
SQL> select substr(truc,1,instr(truc,'-') -1)
from (
select substr('&str1',instr('&str1','-')+1, length('&str1')) as
truc
from dual);

I did use str1 because it is shorter...
Have fun,

Philippe Valentin
(Oracle DBA 8i,9i)



dwilliams (AT) twininteractive (DOT) com (Gotosleep) wrote in message news:<d3f2e241.0407200759.e6204a (AT) posting (DOT) google.com>...
Quote:
I have field that looks like this

Person-12345-(thanks)

I need to select the number in the middle. 12345

Please help...

also the first text PERSON could be any size...

Thank you

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.