3

I need to find the rows where a certain column contains line feed.

This does not work: select * from [table] where [column] like '%\n%'

In SO, I found the solution for SQL Server: New line in Sql Query

But this does not work in Oracle. Is there any ANSI SQL solution? This should be a standard...

If not, what is the solution in Oracle?

Community
  • 1
  • 1
b.roth
  • 9,175
  • 8
  • 35
  • 50

5 Answers5

3

you could look for the CHR(10) character (the character for newline):

select * from [table] where instr(column, chr(10)) > 0
Vincent Malgrat
  • 65,227
  • 9
  • 113
  • 167
3

An alternative to InStr() that expresses the SQL a bit more in line with the problem. IMHO.

select * from [table] where [column] like '%'||chr(10)||'%'
David Aldridge
  • 50,423
  • 8
  • 67
  • 94
1

If you are working with Oracle 10g upwards, you could use

select * from [table] where regexp_like([column], '\n')
Juergen Hartelt
  • 654
  • 4
  • 5
0

select * from tableNameHere where instr(colNameHere, chr(10)) > 0

dpbradley
  • 11,477
  • 30
  • 33
-1

Alternatively:

SELECT * FROM [table] WHERE column LIKE "%\n%"

\n is line feed, \r is carriage return...

tog22
  • 472
  • 1
  • 4
  • 21