Coba d ini create table x1 as select * from table1 where 1<1; Jd intinya jika return no rows maka yg di cr8 ddl nya doank smg bs mmbntu :) Sent from BlackBerry® on 3
-----Original Message----- From: Anthony Kurniawan <[email protected]> Sender: [email protected] Date: Sun, 23 May 2010 12:32:35 To: <[email protected]> Reply-To: [email protected] Subject: Re: [indo-oracle] Re: membuat table dari tabel lain tanpa mengcopy datanya. Dear, Jika Anda menggunakan dbms_metadata.get_ddl memiliki 3 buah parameter : select dbms_metadata.get_ddl('<parameter1>','<parameter2>','<parameter3>') from dual; parameter1 merupakan tipe dari object tersebut, sebagai contoh TABLE, USER, PACKAGE, dll parameter2 merupakan nama dari object tersebut, seperti nama_table, username, nama_package, dll parameter3 merupakan owner dari object tersebut, misal ownernya SYS atau milik user lainnya tergantung dari database Anda... hasil dari query tersebut akan mengeluarkan output berupa perintah DDL untuk membuat object tersebut. hope this can help you... "Gapailah cita-citamu setinggi langit karena jika kau meleset sekalipun, kau akan tetap berada diantara bintang-bintang" --- Pada Sab, 22/5/10, Kang Oyib <[email protected]> menulis: Dari: Kang Oyib <[email protected]> Judul: Re: [indo-oracle] Re: membuat table dari tabel lain tanpa mengcopy datanya. Kepada: [email protected] Tanggal: Sabtu, 22 Mei, 2010, 1:56 PM Maaf pak yulius, untuk select dbms_metadata.get_ddl('TABLE','NAMA_TABLE') from dual; ('TABEL,'NAMA_tabel) pengertiannya gimana, mohon penjelsannya... Trimakasih kang_toyib 2010/5/19 yulius_wibowo <[email protected]> > > > Sekedar nambahin, > Selain pakai CTAS (Create Table As Select) menggunakan WHERE 1=2, > bisa juga diambil perintah DDL-nya (CREATE TABLE ...) menggunakan > DBMS_METADATA.GET_DDL. > > Kalau pakai CTAS, constraint-nya tidak ikut dicopy (kecuali NOT NULL). > Sedangkan kalau pakai DBMS_METADATA.GET_DDL info constraints (PK,FK,NN,U,C) > akan digenerate juga. > > Contoh: > SQL> set long 2000 > SQL> set pages 1000 > SQL> select dbms_metadata.get_ddl('TABLE','NAMA_TABLE') from dual; > ... > > Bw > > > --- In [email protected] <indo-oracle%40yahoogroups.com>, > Antonius Bayu <bayu_9...@...> wrote: > > > > Sorry command createnya kelupaan > > create table copy_barang as select * from barang where 1 = -1; > > > > > > > > > > > > > >________________________________ > > From: Antonius Bayu <bayu_9...@...> > > > To: [email protected] <indo-oracle%40yahoogroups.com> > > Sent: Wed, May 19, 2010 8:04:05 AM > > Subject: Re: [indo-oracle] membuat table dari tabel lain tanpa mengcopy > datanya. > > > > > > Select * from barang > > where 1 = -1 > > > >________________________________ > > From: Aim <freak.luk...@...> > > > To: [email protected] <indo-oracle%40yahoogroups.com> > > Sent: Tue, May 18, 2010 12:01:21 PM > > Subject: [indo-oracle] membuat table dari tabel lain tanpa mengcopy > datanya. > > > > Dear masters oracle. > > saya mau tanya tentang oracle, maklum saya masih newbie. > > > > bagaimana membuat table yang merupakan copyan dari table lain tapi tidak > mengambil data dari tabel yang dicopy. > > > > misal: > > > > SQL> select * from barang; > > > > KODE_BAR NAMA HARGA STOCK > > -------- --------------- ---------- ---------- > > A-112 kaos 150000 15 > > A-113 baju 200000 15 > > A-114 tas 16000 15 > > A-115 sepatu 430000 15 > > A-116 kemeja 970000 15 > > > > SQL> create table copy_barang as select * from barang; > > > > Table created. > > > > MAKA HASILNYA : > > > > SQL> select * from copy_barang; > > > > KODE_BAR NAMA HARGA STOCK > > -------- --------------- ---------- ---------- > > A-112 kaos 150000 15 > > A-113 baju 200000 15 > > A-114 tas 16000 15 > > A-115 sepatu 430000 15 > > A-116 kemeja 970000 15 > > > > yang saya ingin tanyakan, saya ingin membuat table baru yang dicopy dari > tabel lain tetapi hanya columnnya saja TIDAK TERMASUK DML-NYA. > > misAL: > > > > KODE_BAR NAMA HARGA STOCK > > -------- --------------- ---------- ---------- > > > > terima kasih > > lukman > > > > [Non-text portions of this message have been removed] > > > > > > > > > > > > > > > > [Non-text portions of this message have been removed] > > > > > [Non-text portions of this message have been removed] ------------------------------------ -- -----------I.N.D.O - O.R.A.C.L.E--------------- Keluar: [email protected] Website: http://indooracle.wordpress.com http://www.facebook.com/group.php?gid=51973053515 ----------------------------------------------- Bergabung dengan Indonesia Thin Client User Groups, Terminal Server, Citrix, New Moon Caneveral, di: http://indo-thin.blogspot.comYahoo! Groups Links [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] ------------------------------------ -- -----------I.N.D.O - O.R.A.C.L.E--------------- Keluar: [email protected] Website: http://indooracle.wordpress.com http://www.facebook.com/group.php?gid=51973053515 ----------------------------------------------- Bergabung dengan Indonesia Thin Client User Groups, Terminal Server, Citrix, New Moon Caneveral, di: http://indo-thin.blogspot.comYahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/indo-oracle/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/indo-oracle/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

