If you want to create a table by the result set, you can use "create table as (select * from table_name) definition only" statement.
Now we open a new window DB2CLP, issue "CONNECT TO SAMPLE" command, even on the sample database SAMPLE, and then issued a "create table newtest1 as (select * from test1) definition only" command to create the table newtest1, its structure and test1 identical specific as shown in Listing 10:
Listing 10. Through the result set to create the table
C: \> db2 connect to sample
Database connection information
Database server = DB2 / NT 9.1.0
SQL authorization ID = RHETTE
Local database alias = SAMPLE
C: \> db2 create table newtest1 as (select * from test1) definition only
DB20000ISQL command completed successfully.
C: \> db2 select * from test1
- - - - - - - - - - - - - - - - - - -
5 records have been selected.