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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:05:11+00:00 2026-06-12T08:05:11+00:00

Trying to figure out the right way to test if a VARCHAR column value

  • 0

Trying to figure out the right way to test if a VARCHAR column value ends with a carriage return. Tried this but it does not work, database is Oracle 11g…

select name from myTable where name LIKE '%\r' OR name like '%\n'
  • 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-12T08:05:12+00:00Added an answer on June 12, 2026 at 8:05 am

    To find a value that contains non-printable characters such as carriage return or vertical tab or end of line you can use regexp_like function. In your case to display rows where a string value of a particular column contains carriage return at the end the similar query can be used.

    select *
      from your_table_name
     where regexp_like(trim(string_column), '[[:space:]]$')
    

    Demo


    Answer to the comments

    Trim function, by default, deletes leading and trailing spaces and it will not delete carriage return or end of line characters. Lets carry out a simple test:

    SQL> create table Test_Table(
      2    id number,
      3    col1 varchar2(101)
      4  );
    
    Table created
    
    SQL> insert into Test_Table (id, col1)
      2    values(1, 'Simple string');
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    SQL> insert into Test_Table (id, col1)
      2    values(1, 'Simple string with carriage return at the end' || chr(13));
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    SQL> insert into Test_Table (id, col1)
      2    values(1, '   Simple string with carriage return at the end leading and trailing spaces' || chr(13)||'   ');
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    SQL> insert into Test_Table (id, col1)
      2    values(1, '  Simple string leading and trailing spaces  ');
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    SQL> select *
      2    from test_table;
    
            ID COL1
    --------------------------------------------------------------------------------
             1 Simple string
             1 Simple string with carriage return at the end
             1    Simple string with carriage return at the end leading and trailing spaces
             1   Simple string leading and trailing spaces
    
    SQL> 
    SQL> select *
      2    from test_table
      3   where regexp_like(trim(col1), '[[:space:]]$')
      4  ;
    
            ID COL1
    ----------------------------------------------------------------------------------
             1 Simple string with carriage return at the end
             1    Simple string with carriage return at the end leading and trailing spaces
    
    SQL> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out how this is done the right way . I've
I'm trying to figure out the right way to join tables in the given
Trying to figure out the right way to query a MySql database and find
I'm trying to figure out the right way to declare a model for a
I'm trying to figure out the right way to continuously animate the frameRotation of
Trying to figure out why my silverlight app suddenly just displays nothing (right click
I'm trying to figure out, how to disable the padding-right on only one of
Just out of curiosity, I'm trying to figure out which exactly is the right
Trying to figure out how I can do this properly. The print_r looks like
trying to figure out why this is happening - I have an input text

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.