Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

ParseException line 1:162 cannot recognize input near '' '' '' in statement

Solved Go to solution

ParseException line 1:162 cannot recognize input near '' '' '' in statement

New Contributor

I am getting error when running the below query ;

Error occurred executing hive query: Error while compiling statement: FAILED: ParseException line 1:162 cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in statement

With Q as (select CLAIMNUMBER,EXP_ID,EXP_COVERAGE,VEHICLE_STYLE From orc_claiminfo Where VEHICLE_STYLE != "" AND EXP_COVERAGE ="Property Damage - Vehicle Damage");

select * from Q;

Select statement works all well, if I execute separate.

Anyone knows whats the issue??

1 ACCEPTED SOLUTION

Accepted Solutions

Re: ParseException line 1:162 cannot recognize input near '' '' '' in statement

Master Collaborator

Perhaps what you want is a CTAS statement not a CTE.

create table q as select CLAIMNUMBER,EXP_ID,EXP_COVERAGE,VEHICLE_STYLE from orc_claiminfo where VEHICLE_STYLE != "" AND EXP_COVERAGE = "Property Damage - Vehicle Damage"

This way you can use table q later.

3 REPLIES 3

Re: ParseException line 1:162 cannot recognize input near '' '' '' in statement

New Contributor

I have some finding here, if I run only the statement

With Q as (select CLAIMNUMBER,EXP_ID,EXP_COVERAGE,VEHICLE_STYLE From orc_claiminfo Where VEHICLE_STYLE != "" AND EXP_COVERAGE ="Property Damage - Vehicle Damage")

I get the error. But if I run with select * from Q, it works (below).

With Q as (select CLAIMNUMBER,EXP_ID,EXP_COVERAGE,VEHICLE_STYLE From orc_claiminfo Where VEHICLE_STYLE != "" AND EXP_COVERAGE ="Property Damage - Vehicle Damage")

select * from Q

But I don't want to have select immediately after getting the data set. I want to use it later. Any resolution??

Re: ParseException line 1:162 cannot recognize input near '' '' '' in statement

New Contributor

You're saying if you put SQL statements between "with Q..." and "select *..." then you get the error? If so can you share an example SQL statement that is between that causes the error?

Re: ParseException line 1:162 cannot recognize input near '' '' '' in statement

Master Collaborator

Perhaps what you want is a CTAS statement not a CTE.

create table q as select CLAIMNUMBER,EXP_ID,EXP_COVERAGE,VEHICLE_STYLE from orc_claiminfo where VEHICLE_STYLE != "" AND EXP_COVERAGE = "Property Damage - Vehicle Damage"

This way you can use table q later.