Reputation: 9542
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?
Upvotes: 3
Views: 7945
Reputation: 674
If you are working with Oracle 10g upwards, you could use
select * from [table] where regexp_like([column], '\n')
Upvotes: 1
Reputation: 52386
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)||'%'
Upvotes: 3
Reputation: 526
Alternatively:
SELECT * FROM [table] WHERE column LIKE "%\n%"
\n is line feed, \r is carriage return...
Upvotes: -1
Reputation: 11925
select * from tableNameHere where instr(colNameHere, chr(10)) > 0
Upvotes: 0
Reputation: 67752
you could look for the CHR(10) character (the character for newline):
select * from [table] where instr(column, chr(10)) > 0
Upvotes: 3