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'
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
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.
Demo
Answer to the comments
Trimfunction, 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: