问题
In DERBY,
I have a table which name is TEST1. I can run this code perfectly.
CREATE TABLE Table1 AS (SELECT * FROM TEST1) with no data
But I can't run this code and derby.
CREATE TABLE Table1 AS (SELECT ..... FROM sysibm.sysdummy1) with no data
editor throws this error :
ERROR: The CREATE TABLE statement does not include a column list.
ps: "SELECT ..... FROM sysibm.sysdummy1" works with no problem.
How can I create a table with using "select 'columns' from sysibm.sysdummy1" ?
回答1:
in my first code
CREATE TABLE Table1 AS (SELECT ..... x, y, z , 0 FROM sysibm.sysdummy1) with no data
I deleted comma and 0 in query and fixed it! Like that
CREATE TABLE Table1 AS (SELECT ..... x, y, z FROM sysibm.sysdummy1) with no data
回答2:
I think the problem may be that the "dummy" table has no columns, and since you specified no columns in your CREATE TABLE statement, Derby is trying to use the columns from the dummy table, and failing to find any, and saying "does not include a column list".
Why not specify the columns you desire in your result table?
For (a little bit) more information about the dummy table, see: http://apache-database.10148.n7.nabble.com/SYSIBM-schema-td74269.html
来源:https://stackoverflow.com/questions/20262352/create-table-table1-as-select-from-sysibm-sysdummy1