Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9310841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:12:57+00:00 2026-06-19T01:12:57+00:00

a query returns string like AAA[][]AAA[][][][]BBB[][]BBB . I need to replace the four consecutive

  • 0

a query returns string like AAA[][]AAA[][][][]BBB[][]BBB . I need to replace the four consecutive carriage returns with a semicolon but not the consecutive two carriage returns. I have tried

replace(STRING,chr(13)||chr(13)||chr(13)||chr(13),';')

but it has no effect. Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T01:12:58+00:00Added an answer on June 19, 2026 at 1:12 am

    Use CHR(10) on linux/unix systems. On Windows, the carriage returns are composed of two characters CHR(10)||chr(13). On linux:

    SQL> WITH DATA AS (
      2     SELECT 'AAA
      3  
      4  AAA
      5  
      6  
      7  
      8  BBB
      9  
     10  BBB' txt FROM dual
     11  ) SELECT replace(txt, chr(10)||chr(10)||chr(10)||chr(10), ';') rep
     12      FROM DATA;
    
    REP
    ------------------------------
    AAA
    
    AAA;BBB
    
    BBB
    

    Since you you can use newlines directly in expressions, you can make it work on all platforms/character sets with newline characters (I would recommend this solution since it’s portable):

    SQL> WITH DATA AS (
      2     SELECT 'AAA
      3  
      4  AAA
      5  
      6  
      7  
      8  BBB
      9  
     10  BBB' txt FROM dual
     11  ) SELECT replace(txt, '
     12  
     13  
     14  
     15  ', ';') rep FROM DATA;
    
    REP
    --------------------------
    AAA
    
    AAA;BBB
    
    BBB
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following query returns values for months with sales but not for months where
how to return string exclude query string it self. column string = AAA/BBB/CCC result
I have a query that returns a string, as well as an escape character
Mysql query returns result like this collector amount name 1 0.00 gihan 1 2000.00
I have a query that returns a result set of one column, but I
I have one query that returns string value, my query is select case when
I have a for xml raw select query that returns a xml string in
I am writing an SQL query as a Javascript string like that: SQLdetail =
This Query returns left outer join from two tables. var q = from adu
I am trying to write a query in linq that returns results like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.