On Thu, 07 Jun 2007 08:47:00 +0200, Dr.Ruud wrote: > Peter Scott schreef: > >> Is there a simple way to create a new table with the same structure >> as a given one in a *different* database? That means the CREATE >> TABLE foo AS SELECT * FROM bar WHERE 1=2 method won't work. > >> I'd need to have two database handles open. >> They're both Oracle > > I suppose the DBD can give you enough information on the table to > generate a CREATE statement from that.
Yes, it does. I ended up taking the output of DESCRIBE and tweaking it a little. I was just using the opportunity to wonder if there was an even lazier way. The suggestion of another poster to use dbms_metadata (see, e.g. http://builder.com.com/5100-6388-5054021.html) was a good one; I'd not heard of it before. If I have to do more than just column type definitions, or multiple tables, in the future, I'll definitely check it out. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/