All Forums Connectivity
anuj_alex 1 post Joined 07/13
20 Jul 2013
Java Teradata ODBC Error - Only an ET or null statement is legal after a DDL Statement

Hello ,
We have a java program that connects to Teradata using the ODBC Drivers and uses Global Temprory Tables for retrieving data for a Report
The Global Temprory Tables have been created with a preserve rows after commit option
here are the steps in the program
1. Insert records into the global temprory table using Insert into .... statment
2. Collect statistics on 3 column of the temprory table in step 1 using collect stats on temprory ...
3. Issue a select statement from the temprory table using select .....
Step 2 is needed because without it the query runs slow and the statistics help the query optimizer to run the query quicker
When we execute the java program it errors out with "Only an ET or null statement is legal after a DDL Statement" at step 2
One of the solutions was to have a commit but that will not work as all the data inserted into the temprory table in step 1 will be lost after the commit
How can we run the insert , collect stats and select using the same connection

You must sign in to leave a comment.