EXPLAINing a query using variables

Teradata Studio
Teradata Employee

EXPLAINing a query using variables

Following runs fine in SQL Assistant and BTEQ, but Studio (15.10.4) throws generic "Parse Error splitting statement" error.

explain
using (infokey varchar(30))
select *
from DBC.DBCInfoV
where infokey = :infokey

What would be the correct way to run this query in Studio? 


8 REPLIES
Teradata Employee

Re: EXPLAINing a query using variables

Paresh, Try running 'Execute All'. Right click in the SQL Editor to see the context menu. But when I tried to run the statement, Teradata returns the following error: "Executed as Single statement.  Failed [3940 : 42000] A SQL command cannot contain both host variables and parameter tokens". I got the same error in SQL Assistant. 

Teradata Employee

Re: EXPLAINing a query using variables

Francine,

Thanks for checking. I did try the "Execute All" as a work-around and received the same error that you did. Strangely, SQL Assistance (15.10.0.2) for me has no problem running the query (either as "Exexute" or "Execute Parallel") and neither does BTEQ. IIRC, Studio is using the same parser as Teradata PE; and this being a valid SQL statement, not exactly sure why the error.

Following variation doesn't cause any difficulty for the Studio's parser, but Studio has trouble interpreting the result of the execution and eventually throws java.lang.ArrayIndexOutOfBoundsException.

explain
select *
from DBC.DBCInfoV
where infokey = ?
Teradata Employee

Re: EXPLAINing a query using variables

Paresh, Can you try upgrading your version of Studio to the latest, 15.10.01? I ran the SQL and it returned the Explain results without any problems.

Teradata Employee

Re: EXPLAINing a query using variables

I upgraded to 15.10.01 and I still get the same error (ArrayIndexOutOfBoundException:0).

Since you cannot reproduce the results, there might be something wrong with my configuration. Maybe I should try uninstalling and reinstalling TD Studio.

Teradata Employee

Re: EXPLAINing a query using variables

Paresh, You can open an incident and submit your error logs for us to take a look at.

Teradata Employee

Re: EXPLAINing a query using variables

Paresh, It appears to be a JRE 1.8 issue. Is that the version of Java you are running?

Teradata Employee

Re: EXPLAINing a query using variables

You are correct! I do have JRE 1.8. Is JRE 1.8 planned to be supported in near future? If so and if there are no other major issues reported, I'll just use SQL assistant workaround when I need to.

Thanks for your assistance.

Teradata Employee

Re: EXPLAINing a query using variables

Paresh, JRE 1.8 is supported. We will fix this issue in the next release of Studio.