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 834429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:40:13+00:00 2026-05-15T04:40:13+00:00

Is there any sql*plus command to remove \r \n and \t from the result

  • 0

Is there any sql*plus command to remove \r \n and\t from the result set that’s going out to the spool file? That is, “trim” every record?

We’ve used set trim on in the past, but it doesn’t seem to bue what we need right now. I’m trying to avoid calling oracle’s translate, chr functions in the sql query.

For example,

set termout off
set spool somefile.dat
set lin  600

select data from mytable;

set spool off;
exit;

My query returns this

|DATA|
|\n \t\t\t\t\t thisistheactualdata \t\t\t\t\t\t\n|

And I’d like to keep this in my spooled file

thisistheactualdata

update

Well, we ended up doing something like this.

set tab off;
spool /home/oracle/out.dat

set linesize 20
set termout off
set trim on
select regexp_replace(l,'(\t|\n)','') from test;

spool off;
exit;

But got some bad news: We need to run this in oracle 8, and regexp_replace doesn’t seem to be available. 🙁

Thanks in advance.

  • 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-05-15T04:40:13+00:00Added an answer on May 15, 2026 at 4:40 am

    I don’t think you’re going to be able to do this with a SQL*Plus directive. SQL*Plus is a pretty thin client and isn’t designed to touch the data from the result set itself.

    If you don’t want to use the built-in SQL functions to modify the output then I think you’re stuck with post-processing a spooled file.

    EDIT by DCookie:
    Since I missed the OP’s original request for a non-TRANSLATE/CHR based solution (I focused on the OP’s lament that they were stuck with 8i), in fairness to dpbradley I’m going to withdraw my answer and include it as part of this one, since it was clearly considered. Here’s what I wrote:

    You might try the TRANSLATE function for your Oracle 8 situation:

    SELECT TRANSLATE(L,'A'||CHR(10)||CHR(9)||CHR(13),'A') FROM test;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any python packages that help generating SQL queries from variables and classes?
Is there any application/project that provides you with a command line SQL client that
Is there any way to set the column width of the result of desc
Are there any classes that can be queried / modified like a SQL DB
Is there any API SQL Server 2008 offers for .net application to create and
Are there any pitfalls when upgrading SQL Server Express to SQL Server Standard 2008
Is there any way to identify which SQL Agent job is running a stored
Is there any way to add a SQL Server Database Diagram to source control?
Is there any open source software for converting SQL statements to LINQ?
Is there any way to convert differential backup to SQL statements which will produce

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.