DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Ask for replace

  1. #1
    Join Date
    Mar 2001
    Posts
    18

    Question

    Dear all,


    I want to replace the first of @ by # in the data
    Example
    abc@0001@1234 -> abc#0001@1234


    Best regards

    Gab

  2. #2
    Join Date
    Jan 2001
    Posts
    50
    you can use strreplace to replace the character
    Aniruddha Gupta

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    You can use INSTR function to find N-th occurence of a character within a string. In your case you would use

    REPLACE (SUBSTR('abc@0001@1234', 1, INSTR('abc@0001@1234', '@', 1, 1), '@', '#') ||
    SUBSTR(SUBSTR('abc@0001@1234', INSTR('abc@0001@1234', '@', 1, 1)+1)

    If you would like to replace the first *two* occurances of '@' you would change '@', 1, 1 to '@', 1, 2 inside the INSTR functions.

    HTH,
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Mar 2001
    Posts
    18

    Question What is "strreplect" command

    Dear sir,


    What is the "strreplace" command?
    Could you tell me the detail?

    Best regards


    gab

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width