Contoh sederhana, mislkan hendra mempunyai suatu object dalam satu table
Dan katakanlan objecntnya macam2 tapi satu jenis,
Dan supaya yang macam2 jenisnya ini tergolong dalam satu kelompok
Maka di buat id refrensi ato istilahnya id induk dan anak
Seperti contoh

create table testing_kelompok
(
idku number,
id_induk number,
nama varchar2(255)
)



Insert into testing_kelompok
   (IDKU, NAMA)
 Values
   (1, 'kelompok cat');
Insert into testing_kelompok
   (IDKU, ID_INDUK, NAMA)
 Values
   (2, 1, 'catilak');
Insert into testing_kelompok
   (IDKU, ID_INDUK, NAMA)
 Values
   (3, 1, 'propaint');
Insert into testing_kelompok
   (IDKU, ID_INDUK, NAMA)
 Values
   (4, 1, 'cat kayu');
Insert into testing_kelompok
   (IDKU, ID_INDUK, NAMA)
 Values
   (5, 1, 'cat pilok');
COMMIT;



Cek dengan query ini di toad/plsql developer
hasilnya bisa dilihat juga kalo hendra buat tree di form dengan
menggunakan hirarcy tree
select 1, level, nama, NULL, to_char(idku)
from testing_kelompok 
connect by prior idku=id_induk
start with idku = 1
ORDER BY idku


Hasilnya
1      level    nama        to_char(idku)
1.00    1.00    kelompok cat    1
1.00    2.00    catilak         2
1.00    2.00    propaint        3
1.00    2.00    cat kayu        4
1.00    2.00    cat pilok       5


Bisa di lihat dari level
Level 1 artinya induk
Dan yg lainya merupakan reference ke nomor 1

--- In [email protected], bapux oke <[EMAIL PROTECTED]> wrote:
>
> Mas Hendri, saya mau tanya dunk OOT sih,
> Saya mau untuk FROM mas khan pake table yang sama tapi pemakaiannya
dua kali, nah maksudnya gimana sih, soalnya saya suka bingung kenapa
harus pakai table yang sama dua kali. 
> Mohon pencerahannya.
> 
> Hendra
> 
> "Hendi, Ade - ID (IS)" <[EMAIL PROTECTED]> wrote:                      
           Dear
>  
>  Setiawan coba ini
>  
>  SELECT t.owner CHILD_OWNER,
>  
>  t.table_name CHILD_TABLE,
>  
>  t.constraint_name FOREIGN_KEY_NAME,
>  
>  r.owner PARENT_OWNER,
>  
>  r.table_name PARENT_TABLE,
>  
>  r.constraint_name PARENT_CONSTRAINT
>  
>  FROM user_constraints t, user_constraints r
>  
>  WHERE t.r_constraint_name = r.constraint_name
>  
>  AND t.r_owner = r.owner
>  
>  AND t.constraint_type='R'
>  
>  _____  
>  
>  From: [email protected] [mailto:[EMAIL PROTECTED]
>  On Behalf Of Ferry Setiawan
>  Sent: Tuesday, January 30, 2007 9:09 AM
>  To: Indo-Oracle
>  Subject: [Fwd: [indo-oracle] Data Constraint]
>  
>  maaf reposting...SOL
>  
>  -------- Original Message --------
>  Subject: [indo-oracle] Data Constraint
>  Date: Sat, 27 Jan 2007 09:04:21 +0700
>  From: Ferry Setiawan <[EMAIL PROTECTED]
>  <mailto:ferry.setiawan%40platinumceramics.com> >
>  Reply-To: [email protected]
>  <mailto:indo-oracle%40yahoogroups.com> 
>  To: Indo-Oracle <[email protected]
>  <mailto:indo-oracle%40yahoogroups.com> >
>  
>  Dear All
>  
>  Dengan menggunakan perintah
>  select * from user_constraints
>  hasilnya adalah semua constraint akan muncul tetapi tidak ada data
table
>  
>  mana yang di refer.
>  jadi hanya nama constraint dan nama table yang memiliki constraint
>  tersebut.
>  misal
>  TableA --> FK_A_B --> TableB
>  yang muncul adalah FK_A_B dan TableA,
>  nah sekarang bagaimana caranya saya bisa mendapatkan TableB? bagaimana 
>  querynya?
>  mohon bantuan teman teman...
>  
>  Thanks
>  Ferry S
>  
>  The information contained in this email is or may be confidential,
legally privileged, and proprietary in nature or otherwise protected
by law from disclosure and is intended solely for the use of the
addressee. If you are not the intended recipient, you are hereby
notified that any disclosure, dissemination, distribution, copying or
use of any part of this mail is strictly prohibited and unlawful. If
you received this email in error, please immediately notify the sender
or our email administrator at [EMAIL PROTECTED] and delete it from your
system. Thank you.
>  
>  [Non-text portions of this message have been removed]
>  
>  
>      
>                        
> 
>        
> ---------------------------------
> Looking for a deal? Find great prices on flights and hotels with
Yahoo! FareChase.
> 
> [Non-text portions of this message have been removed]
>


Kirim email ke