Forum: Managing VoltDB

Post: DDL mixed with DML

DDL mixed with DML
alessandro.portosa
Mar 6, 2015
Dear all,
I'm trying to use a reeally basic SQL statement as the following: CREATE TABLE test AS ( SELECT * FROM station ) WITH DATA;
I made few test from VoltDB (v5.1) Management Center -> SQL Query tab.
1) I cannot use WITH NO DATA, it raises NullPointerException. Using WITH DATA is instead ok, but no data are copied. I can easily workaround this bug by using INSERT statement.
2) By doing exactly the same via JDBC, I got the following error: java.sql.SQLException: General Provider Error (GRACEFUL_FAILURE): 'DDL mixed with DML and queries is unsupported.'

So, is there any via SQL statement to create a table from a SELECT query?

Thanks.
bballard
Mar 6, 2015
Hi Alessandro,

Here is the documentation for the supported DDL statements and their syntax: http://docs.voltdb.com/UsingVoltDB/AppxDDL.php

The CREATE TABLE statement doesn't support the syntax you attempted. In VoltDB Management Center, you could copy the "CREATE TABLE station..." from the DDL tab and paste it on the Execute SQL page, changing the name of the table to "test". Then you could use "INSERT INTO test SELECT * FROM station;" or some other INSERT statement. Note that VoltDB is optimized for running transactions that involve small numbers of records at high rates of concurrency and throughput. If the station table is too large, you might need to break it up into multiple INSERT statements.

Thanks,
Ben
alessandro.portosa
Mar 10, 2015
Thanks for the support!

A.