Problems with dynamic creation of Volatile tables in Teradata

When you don't want to specify non primary index(PI) for a new table which is created using the other existing table,
CREATE VOLATILE TABLE myTemp AS SourceDb.SourceTable 
WITH NO DATA NO PRIMARY INDEX ON COMMIT PRESERVE ROWS;


The above statement will fail,
ERROR
WARNING: Failed to execute: CREATE VOLATILE TABLE myTemp AS SourceDb.SourceTable
WITH NO DATA NO PRIMARY INDEX ON COMMIT PRESERVE ROWS;
because: [Teradata Database] [TeraJDBC 14.00.00.13] [Error 5339] [SQLState HY000] Index name not allowed for volatile table.


The above problem can be solved by mentioning the table data instead of table structure,

CREATE VOLATILE TABLE myTemp AS (SELECT * FROM SourceDb.SourceTable)
WITH NO DATA NO PRIMARY INDEX ON COMMIT PRESERVE ROWS;