slipt a string into 2 word in Oracle PL?SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 0301102
    New Member
    • Jul 2007
    • 6

    slipt a string into 2 word in Oracle PL?SQL

    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
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you can use the string functions like length,substrin g,instring etc for the purpose

    Comment

    • madankarmukta
      Contributor
      • Apr 2008
      • 308

      #3
      Originally posted by 0301102
      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!

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Try This:


        [code=oracle]
        SQL> select SUBSTR('seng.co m.my',1,INSTR(' seng.com.my','. ',1,1) - 1) str_1,SUBSTR('s eng.com.my',INS TR('seng.com.my ','.',1,1)) str_2 from dual
        /

        STR_ STR_2
        ---- -------
        seng .com.my

        SQL>

        [/code]

        Comment

        Working...