Using DDL and DML - Teradata

Answered

Hi,

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
as
(
...
)
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?
Thanks!
Adam
1 comment
Comment actions Permalink

I checked Terradata documentation for your issue.

3576 Data definition not valid unless solitary.
Explanation:

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.


Remedy:

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.

 

0

Please sign in to leave a comment.