Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Exception: Syntax error when trying to Escape the apostrophe

avatar
Visitor

Hi,

I am getting the below error when trying to escape the apostrophe character in HUE Impala.

 

select * from hi_problem_view
where
state like 'Won''t fix'

 

won't fix is a value that I am trying to filter by for records.  

 

Error:

AnalysisException: Syntax error in line 3:undefined: state like 'Won''t fix' ^ Encountered: STRING LITERAL Expected: AND, BETWEEN, DIV, GROUP, HAVING, ILIKE, IN, IREGEXP, IS, LIKE, LIMIT, NOT, OFFSET, OR, ORDER, REGEXP, RLIKE, UNION CAUSED BY: Exception: Syntax error

1 ACCEPTED SOLUTION

avatar
Expert Contributor

I'd suggest you use a backslash to escape special characters. Please try this query:

select * from hi_problem_view 
where 
state like 'Won\'t fix'

 

View solution in original post

2 REPLIES 2

avatar
Expert Contributor

I'd suggest you use a backslash to escape special characters. Please try this query:

select * from hi_problem_view 
where 
state like 'Won\'t fix'

 

avatar
Visitor

Thanks! That worked