Return-Path: Delivered-To: apmail-incubator-empire-db-user-archive@minotaur.apache.org Received: (qmail 60670 invoked from network); 19 Nov 2010 10:20:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Nov 2010 10:20:24 -0000 Received: (qmail 5950 invoked by uid 500); 19 Nov 2010 10:20:55 -0000 Delivered-To: apmail-incubator-empire-db-user-archive@incubator.apache.org Received: (qmail 5922 invoked by uid 500); 19 Nov 2010 10:20:54 -0000 Mailing-List: contact empire-db-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: empire-db-user@incubator.apache.org Delivered-To: mailing list empire-db-user@incubator.apache.org Received: (qmail 5914 invoked by uid 99); 19 Nov 2010 10:20:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 10:20:53 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [88.79.172.157] (HELO mail.esteam.de) (88.79.172.157) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 10:20:47 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: re: Create table as Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Fri, 19 Nov 2010 11:20:24 +0100 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: re: Create table as Thread-Index: AcuHVTnZO2Wjjb2vTM2XHDXgg/OMwwAfC8yg References: From: =?iso-8859-1?Q?Rainer_D=F6bele?= To: Hello Jorge, actually no, but it is not hard to achieve. Personally normally separate creating tables (DDL statements) from data = manipulation statements as you normally have a given table into which = you want to insert your data. Hence I normally solve it somewhat like this: // Define the table DBTable myTable =3D new DBTable("MYTABLE", db); myTable.addColumn(...); // Create the table DBSQLScript script =3D new DBSQLScript(); db.getDriver().getDDLScript(DBCmdType.CREATE, myTable, script); script.run(db.getDriver(), conn, false); // now fill the table using "SELECT INTO ..." db.executeSQL(cmd.getInsertInto(myTable), conn); if you want to do this in one step using CREATE TABLE ... AS SELECT ... = you can to it as follows: // Define the table DBTable myTable =3D new DBTable("MYTABLE", db); myTable.addColumn(...); // Create and execute a "CREATE TABLE ??? AS SELECT ..." StringBuilder s =3D new StringBuilder(); s.append("CREATE TABLE "); myTable.addSQL(s, DBExpr.CTX_NAME); s.append(" AS "); cmd.getSelect(s); db.executeSQL(s.toString(), conn); This however is Oracle specific and won't work for other databases. Regards Rainer Jorge Mu=F1iz Mor=E1n wrote: > from: Jorge Mu=F1iz Mor=E1n [mailto:jorge.muniz@nortia-in.es]=20 > to: empire-db-user@incubator.apache.org > re: Create table as > > Hi everybody, > > This is the first mail that I send to the list so, first of all, I = would like to thank all the contributors of Empire-db for their awesome = work!! > > I would like to know if 'create table as select' queries are supported = in the latest Empire version. I'm not able to find it anywhere. > > Many thanks in advance, > Jorge Mu=F1iz > @jmunizmoran