Using DDL and DML - Teradata



I'm trying to run two queries in Teradata (using the JDBC driver) and keep getting this error that drives me crazy.

I try to run a routine query followed by a create table query:

CALL monitor.drop_table('xxxx');
create table xxxxxx
with data unique primary index();

I keep getting the same error:
"Data definition not valid unless solitary"

Any idea on how I can fix this and be able to run both queries subsequently?
1 comment
Comment actions Permalink

I checked Terradata documentation for your issue.

3576 Data definition not valid unless solitary.

Data definition statements are not allowed in a multi-statement request and they must be the last statement
in an explicit user transaction. A data definition statement may be used in a macro,
but only when the only statement in the macro is the data definition statement.


Submit each data definition statement as a separate transaction.


When you run query in DataGrip console in behind IDE wraps your query into transaction. To solve the problem you need to run queries one by one instead of batch. Make sure you set transaction control to Auto.



Please sign in to leave a comment.