Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with trimming a string

Status
Not open for further replies.

mikedaruke

Technical User
Mar 14, 2005
199
US
Hi,

I have a FQDM in a database and I want to drop the domain. How can I do that in a select? Was trying RTRIM but I need to use wildcards. Pretty much from the first period to the end i want deleted.

So...

Server.domain.com

is

Server

Thanks!
 

Try:

Code:
SUBSTR(FQDM,1,INSTR(FQDM,'.')-1)
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Try

select substr('server.domain.com',0,instr('server.domain.com','.')-1)
from dual



In order to understand recursion, you must first understand recursion.
 
Thanks guys, one last thing, can you do a or statement in a replace?

Like if I have two things to replace?

Something like this?

replace(column, 'replace || replace 1', '')
 
Yes, you may place functions (or operations), inside of functions (or operations), inside of function (or operations), ad nauseum.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
In my post, above, I should have used the term "nest" instead of "in", but you still get the point, I hope. <grin>

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top