Hierarchical query - Stop at specific leaf nodes - How to in Oracle 9i ?
Table H -- Master table to build Hierarchical tree
C -- Child
P -- Parent
Table RN -- Table defining Root Nodes
N -- Node
Table LN -- Table defining Leaf Nodes
N -- Node
The following Query can generate trees starting with the nodes specified in the Table:RN
SELECT LEVEL L, C, P, SYS_CONNECT_BY_PATH(C,'/') SCBP
FROM H
START WITH C IN ( SELECT N FROM RN )
CONNECT BY PRIOR C = P
How do I limit the tree to the nodes specified in the LN table ?
"CONNECT BY" does not support "IN" clause
i.e
CONNECT BY PRIOR C = P AND P NOT IN (SELECT N FROM LN)
Say we have 2 trees
1-2-3-4-5
A-B-C-D-E
RN : 2,B
LN : 5,D
Result:
2,3,4 (5 is excluded)
B,C (D is excluded)
Any help is appreciated...
What about:
select level l, c, p, sys_connect_by_path(c,'/') scbp
from (select * from h
where c not in (select n from ln)) -- filter via an inline view
start with c in ( select n from rn )
connect by prior c = p;
Similar Messages
-
Hierarchical Query from a leaf node
I have thist table
create table employee(
emp_id number(7) not null
name varchar(30)
supervisor_id number(7)
Constraint PK_employee primary key(emp_id))
This is my data
Insert into employee(emp_id,name) values (1,Boss)
Insert into employee values(2,Subordinate1,1)
Insert into employee values(3,Subordinate2,1)
Insert into employee values(4,Subordinate3,1)
Insert into employee values(5,Subordinate4,2)
Insert into employee values(6,Subordinate5,5)
Insert into employee values(7,Subordinate6,3)
In my program, I'll be given the leaf node lets say, Subordinate5, I want to get the whole hierarchy for that subordinate like this:
Boss\Subordinate1\Subordinate4\Subordinate5
or Subordinate 6
Boss\Subordinate2\Subordinate6
Help will be greatly appreciated. Thanks.Here is another - a little bit rewritten - version:
michaels> SELECT full_path
FROM (SELECT LTRIM (SYS_CONNECT_BY_PATH (NAME, '\'), '\') AS full_path
FROM employee e
CONNECT BY PRIOR emp_id = supervisor_id ORDER BY LEVEL DESC)
WHERE ROWNUM = 1 AND SUBSTR (full_path, INSTR (full_path, '\', -1) + 1) = 'Subordinate5'
FULL_PATH
Boss\Subordinate1\Subordinate4\Subordinate5
1 row selected. -
Leaf Node access in a BW OLAP Universe - BEX Query
How we can gain access in an universe to just the lowest leaf node in an bex query with hierarchies. If an infoobject has a hierarchy that is ragged, I just want to display that lowest level with a value.
Is there an MDX work around
An example is cost center or account which may be many levels.
The goal is to create a universe such that in webi or explorer, the user has to deal with one field for cost center or account and not 7 levels for each which make it very hard for the end user.
In this case the hierarchy is not important.Hi,
I assume that you want to say XML traces rather than SQL traces.
We provide SQL for relational databases and SAP BW Infocubes/DSO through Data Federator.
The MDX generated contains only the characteristics and key figures selected in the Query Panel.
However, there were an issue where all key figures were taken into account by SAP BW server even if not all have been selected.
This issue has been fixed in a fix pack (I don't remember which one).
Regards
Didier -
How to Find the node or leaf node selected in Tree UI element:
Hi All,
I have a tree structure with three level design. We have a button, which will perform some operation on the specific node or leaf node on every level.
When we select any node or leaf node, we have action Onction getting called. But what we want is that, after we select the node or leaf node, we press a button below the tree design and perform some operation on the node selected.
But how to get information that on Application , which node or leaf node has been slected ?
Thanks
PGHi,
Found the solution.
Juts keep on reading all the nodes, system gives the complete path of the tree by using Lead selection and then we can use this path to peform the update operation on tree structure.
Thanks alot for the hint.
Regards
PG -
ADF TreeTable - How to hide Disclose/Expand icon for leaf node
We are using ADF Tree Table in our application.
Whenever a node is expanded - all the child nodes have the disclose/expand icon along with it.
But, we don't want to show the disclose/expand icon if it is a leaf node.
How can this be done?
JDeveloper Version: JDeveloper 11.1.1.3
Thanks,
NavaneethI have a hierarchical tree based on single POJO based class exposed as data control.
(i.e) a node can have many levels.
Can you specify how we can use the folder icon for this - Can you please provide some detailed information?
Thanks in advance,
Navaneeth -
How to make the leaf node of the APEX tree downloadable
Hi All,
I am trying to build a "library" page for my application, with the documents as the leaf nodes of the tree. The documents come from a database table, and each document is a BLOB.
My question is, how should I write the "link" part of the APEX tree query to make the lead node document downloadable for the end users?
Thanks,
ChristineHilary helped me out of this by creating a new form page with two new items there corresponding to the PK and BLOB column, then in the tree query use apex_util.get_blob_file_src function as the link. Below is the email from Hilary:
1. Created Form, page 13, based upon your table storing the documents as BLOBs. The form page has just two associated items: P13_DOC and P13_DOC_ID. The item P13_DOC is of type FILE and contains a source type of DB column, which is the first required parameters of the function get_blob_file_src. NOTE: I could have created a form region on the same page as your tree, but chose to generate a separate page. You may choose to change this yourself.
2. Updated the Tree query on pg 12 to use the following link for tree nodes of level 4:
apex_util.get_blob_file_src('P13_DOC',v.attr3)
...where P13_DOC is the application page item mentioned in step 1 above, and v.attr3 should hold the unique ID associated with the document. Your tree now allows users to download the listed documents. -
How to know which leaf node i click and how to add a listener to each node?
hi! hello to all members, i have a problem i know how to create a listener, but i dont know how to add a listener to each leaf node. here is the scenario i want to do, i have a JTree where theres a topic that you can select on each leaf node, so when the user click the specific topic it will open another JFrame,which i dont know how to do it also, that its! the next problem will be how do i know which leaf node i select, so that i can open a right topic before the JFrame will open?please, i am very need this to solve quickly as possible. thanks again to all members.
What you have to do is to add a mouse listener on your JTree. Try something like this:
tree.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(MouseEvent e) {
tree_mouseReleased(e);
private void tree_mouseReleased(MouseEvent e) {
TreePath selPath = tree.getSelectionPath();
// Check If the click is the Right Click
if (e.isPopupTrigger() == true) {
// This is your right Click
else {
// This is your Left Click
}Your other problem: Set the userObject on nodes and on left click compare it with your object, if it matches, display the appropriate file. Alternatively, if your nodes are unique, you can match the names to open the file.
Hope this Helps
Regard
Raheel -
How to get the leaf node in a hierachy????
if i get a record that a parent node in a hierachy table ,so how can i get the leaf node of this parent node quicklly?????thank you!
Hi xuhuanjun ,
Refer to the below threads which disucss the same.
Re: how to ensure a hierarchy tree's node is a internal leaf???????
Re: Retrieve Hierarchy Leaf Node using API.
Hope it helps.
Thanks,
Minaz -
Question
when I log into Firefox, the screen scrolls down and I have to use the side-bar to go back up to type my query into the 'search' window. How can I stop that and get Firefox to start with the 'search' window accessible? With thanks, PeterSee this. <br />
https://support.mozilla.com/en-US/kb/Firefox+hangs#Hang_at_exit -
Question
When I log into Firefox, the screen scrolls down and I have to use the side-bar to go back up to type my query into the 'search' window. How can I stop that and get Firefox to start with the 'search' window accessible? With thanks, PeterSee this. <br />
https://support.mozilla.com/en-US/kb/Firefox+hangs#Hang_at_exit -
How to Create Interface specific Monitoring Node in RZ20
Is it possible to create Interface/namepsace specific Monitoring node in CCMS RZ20. If yes, then how??? I need to have this node in ECC system.
Thanks and Regards,
Pallavi SinghHi,
It is possible to achieve this using the MTE class SXMB - this will allow thr highlight of errors within the local IE.
Is this what you need ??
Kind regards
Colin. -
Hi,
My current JTree code behavior is such that when I add new node in JTree it adds to it's parent and selects that node by default (I mean focus goes to the new node).. and can keep max three node and 5 leaf
Following is an example of that:
RootNode
-Node1
--Node1a
--Node1b
-Node2
--Node2a
-Node3
--Node3a
--Node3b
The scenario is:
When I add a new leaf it should see if total five leaf is connected in any combination of any node and give msg 'u can connect max 5 leaf'...
i mean if one node ---max 5 leaf
if two node is connected ---max 5 leaf(we can add 5 leaf in two node)
if three node is connected---max 5 leaf(we can add 5 leaf in three node)
How do i proceed.... need help
regards
tariqueRedefine add() method of your node and do your processing there.
Denis Krukovsky
http://dotuseful.sourceforge.net/ -
Hierarchical query - How to get all parent records - Duplicate post
Hi,
In Oracle, START WITH, CONNECT BY commands will give all the direct and indirect child records. Other way round, is they are command which gives all the parent records till the root? Please let me know. I am working on Oracle 9i Release 2.
Thanks a lot for your help.
Edited by: skv on Nov 21, 2008 11:05 AMDuplicate post.
Hierarchical query - How to get all parent records
Please edit this post heading to duplicate post.
Regards.
Satyaki De. -
How to convert SQL Server hierarchical query (CTE) to Oracle?
How to convert SQL Server hierarchical query (CTE) to Oracle?
WITH cte (col1, col2) AS
SELECT col1, col2
FROM dbo.[tb1]
WHERE col1 = 12
UNION ALL
SELECT c.col1, c.col2
FROM dbo.[tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
DELETE a
FROM dbo.[tb1] AS a INNER JOIN cte AS b
ON a.col1 = b.col1See: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2129904
Ah, just spotted it's a delete statement - you won't be able to do it using subquery factoring in Oracle.
I had a go at trying to convert for you, but notice that you reference the cte from inside the cte... I can only assume you have a table called cte too...
DELETE FROM dbo.tb1
WHERE col1 = 12
OR col2 IN (SELECT col1 FROM cte)
Edited by: Boneist on 22-Jun-2009 09:19 -
How to connect to a specific server node?
Hi,
For support purposes, I would need to know how I could force the connection to a specific server node?
For example, I have the following info in my jcmon:
Idx
Name
Cluster
Debug
HTTP
HTTPS
P4
Telnet
SDM
Id
Port
Port
Port
Port
Port
Port
0
dispatcher
17313700
50000
50100
50101
50104
50108
0
1
server0
17313750
50121
0
0
0
0
0
2
server2
17313752
50131
0
0
0
0
0
3
SDM
0
50003
50119
0
0
0
50118
I would like to be able to choose which specific node I'm to use.
Thank you,
Jerome M.Jerome,
If by "specific server node" you mean the chice between server0 or server2, there is no choice.
You can connect only to dispatcher via dispatcher port.
Dispatcher will make sure your subsequent requests will be processed by the same server node, but, to my best knowledge, it is not possible to tell dispatcher what server node to use for initial connection.
Why do you need this option?
Maybe we can suggest you some other working solution.
Regards,
Slava
Maybe you are looking for
-
How can I put two icloud accounts in the same pc?
Hallo, I have two icloud accounts, one for me and another for my wife, and I would like to put the two accounts in the same pc, because I want to share all the photos of the two accounts with the pc automatically, but I do not know how to do this. Th
-
Invoice of downpayment of 100%
Sometimes when we sell a material we sometimes ask the downpayment of 100% of the order. When we deliver a material we issue a delivery note and the final invoice, but it is impossible to issue a final invoice of 0 Euro with a registration on the
-
I am a teacher and accidentally rented a movie twice. Once in HD and it told me I could not project it over my promethean board. So I rented it in the regular format and I had problems downloading it. Could I get a refund or at least a credit?
-
Which is better to use Shell Script or Alerts in OMS
HI This is a point of confusion for me to decide that for monitoring the databases what should be used the Alerts Set in the Management Server or Shell scripts . May I have your valuable suggestions with reason for supporting the suggestion
-
Error message after installing OS
My son's G4, 1.42 GHz (isn't this what's called a quicksilver - mirror-like panel on front?) Power Mac's hard drive crashed. I replaced the drive with a 320 GB parallel ATA drive (Western Digital). I formatted drive as 1 partition and tried to instal