Support Questions

Find answers, ask questions, and share your expertise

Assign variable to the query results in Impala

avatar
New Contributor

I am trying to assign a value to a variable using single value result from a query but i keep getting syntax error . I am using HUE - Impala Editor 

Result of "Select distinct MonthEndSnapshotKey FROM vmge_1h_bmh_lynx_non_pu_sec.rundtcur" = 202005 with data type INT .

I want to assign it to variable Testvar 

 

SQL statements : 

SET $(testvar=Select distinct MonthEndSnapshotKey FROM vmge_1h_bmh_lynx_non_pu_sec.rundtcur};

select $(testvar}

  • ParseException: Syntax error in line 1:undefined: SET $(testvar=Select distinct Mon... ^ Encountered: ( Expected: = CAUSED BY: Exception: Syntax error
1 REPLY 1

avatar
Expert Contributor

Hi @SDPLearner Can you please check and confirm if it works using impala-shell or not.