RE: String Manipulation

  • From: "Bobak, Mark" <Mark.Bobak@xxxxxxxxxxxxxxx>
  • To: <shivaswamykr@xxxxxxxxx>, "Oracle-L" <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 17 May 2007 14:07:31 -0400

Try this:
select
substr('instance.company.com',1,instr('instance.company.com','.')-1)
from dual;

-Mark

-- 
Mark J. Bobak 
Senior Oracle Architect 
ProQuest/CSA 

"There are 10 types of people in the world:  Those who understand
binary, and those who don't." 

 

________________________________

From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Shivaswamy Raghunath
Sent: Thursday, May 17, 2007 1:22 PM
To: Oracle-L
Subject: String Manipulation


Hello.

I need to get "instance" from ('instance.company.com') on SQLPLUS. How I
can do this? 

I tried to use REGEXP_SUBSTR function, but could not make much headway.
Please note that, the LENGTH(instance) may vary. 

So I guess, give me before first occurence of period(.) in the string is
what I should ask to get.

TIA,
Shiva


Other related posts: