Connecting Tech Pros Worldwide Forums | Help | Site Map

slipt a string into 2 word in Oracle PL?SQL

Newbie
 
Join Date: Jul 2007
Posts: 6
#1: Jan 3 '09
Hi,

I have a input parameter call DOMAIN_NAME (Example: seng.com.my), and i need slipt it into 2 word, becasue "seng" is the label and ".com.my" is the zone,
so my i know how to slpit it into two word? Or any one have a better idea to solve the mentioned problem? Your help will be appreciated. Thx.


Thanks & Regards
seng

debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,509
#2: Jan 3 '09

re: slipt a string into 2 word in Oracle PL?SQL


you can use the string functions like length,substring,instring etc for the purpose
Familiar Sight
 
Join Date: Apr 2008
Posts: 149
#3: Jan 14 '09

re: slipt a string into 2 word in Oracle PL?SQL


Quote:

Originally Posted by 0301102 View Post

Hi,

I have a input parameter call DOMAIN_NAME (Example: seng.com.my), and i need slipt it into 2 word, becasue "seng" is the label and ".com.my" is the zone,
so my i know how to slpit it into two word? Or any one have a better idea to solve the mentioned problem? Your help will be appreciated. Thx.


Thanks & Regards
seng

Hi,

You can makes use of the REgular expression if you are working with Oracle - 8i above.This will be the most generic solution to you question.

Thanks!
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#4: Jan 15 '09

re: slipt a string into 2 word in Oracle PL?SQL


Try This:


Expand|Select|Wrap|Line Numbers
  1. SQL> select SUBSTR('seng.com.my',1,INSTR('seng.com.my','.',1,1) - 1) str_1,SUBSTR('seng.com.my',INSTR('seng.com.my','.',1,1)) str_2 from dual
  2. /
  3.  
  4. STR_ STR_2
  5. ---- -------
  6. seng .com.my
  7.  
  8. SQL> 
  9.  
  10.  
Reply

Tags
oracle, pl/sql, slipt