Pseudo column connect_by_root adalah new feature Oracle 10g. Jadi kalau
menggunakan Oracle yang versinya di bawah 10g maka error. Untuk 9i,
connect_by_root dapat digantikan dengan sys_connect_by_path dengan sedikit
manipulasi.
select jaringan, max(tingkat) jumlah
from (select replace(sys_connect_by_path(decode(level, 1, idjar),'&'),'&')
jaringan, level-1 tingkat
from my_table
start with konek_ke is null
connect by prior idjar = konek_ke
)
group by jaringan
order by jaringan
--
Regards,
Rudi Kristanto.
________________________________
From: tri afirianto <[email protected]>
To: [email protected]
Sent: Wednesday, September 16, 2009 9:46:02
Subject: Re: [indo-oracle] Minta bantuan Query Level
saya coba querynya kok tidak jalan ya mas rudi??
yg gagal itu terletak di connect_by_root
--- On Tue, 9/15/09, musisi musisi <tc2681_2006@ yahoo.com. sg> wrote:
From: musisi musisi <tc2681_2006@ yahoo.com. sg>
Subject: Re: [indo-oracle] Minta bantuan Query Level
To: indo-oracle@ yahoogroups. com
Date: Tuesday, September 15, 2009, 6:41 PM
Makasih atas bantuannya pak Rudi
--- On Tue, 15/9/09, rudi kristanto <rudiathome@ yahoo. com> wrote:
From: rudi kristanto <rudiathome@ yahoo. com>
Subject: Re: [indo-oracle] Minta bantuan Query Level
To: indo-oracle@ yahoogroups. com
Date: Tuesday, 15 September, 2009, 9:34 PM
select jaringan, max(tingkat) jumlah
from (select connect_by_root idjar jaringan, level-1 tingkat
from my_table
start with konek_ke is null
connect by prior idjar = konek_ke
)
group by jaringan
order by jaringan
--
Regards,
Rudi Kristanto.
____________ _________ _________ __
From: musisi musisi <tc2681_2006@ yahoo.com. sg>
To: Indo oracle <indo-oracle@ yahoogroups. com>; OCS <oracle-coretech-
surabaya@ yahoogroups. com>
Sent: Tuesday, September 15, 2009 9:26:34
Subject: [indo-oracle] Minta bantuan Query Level
Rekans,
saya minta tolong masalah query, saya punya table my_table dengan field dan
data sbb:
idjar || konek_ke
------------ --------- --
a1 ||
a2 ||
a3 ||
b1 || a1
b2 || a2
c1 || b1
d1 || c1
e1 || d1
saya sudah dapat menampilkan posisi tree sbb :
a1
---> b1
-------> c1
-----------> d1
------------ -> e1
a2
----> b2
a3
dengan query sbb:
select lpad ( ' ',4*(level+1) ) || idjar as idjar
from my_table
start with konek_ke is null
connect by prior idjar=konek_ ke
yang ingin saya tanyakan, query untuk menampilkan data sbb :
idjar || jumlah_jar
------------ --------- ---
a1 || 4
a2 || 1
a3 || 0
tolong pencerahannya.
Thx
Get your new Email address!
Grab the Email name you've always wanted before someone else does!
http://mail. promotions. yahoo.com/ newdomains/ sg/
[Non-text portions of this message have been removed]
Get your new Email address!
Grab the Email name you've always wanted before someone else does!
http://mail. promotions. yahoo.com/ newdomains/ aa/
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
____________ _________ _________ _________ _________ __
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail. yahoo.com
[Non-text portions of this message have been removed]
New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/
[Non-text portions of this message have been removed]