How to find the id of the node given the path using connect by?
I have a table like this:
CREATE TABLE tab1 (Id INTEGER, Name VARCHAR2(100), ParentId INTEGER)
Let's say I have the following rows:
Id name ParentId
1 X NULL
2 Y 1
3 Z 2
4 A 3
Now, given the path /X/Y/Z/A, I need to return 4
Is it possible to achieve this using CONNECT BY?
If it helps, I have over simplified the scenario - that a node has only one child. In reality, a node can have many children.
Thanks.
Hi,
user2888313 wrote:
Thanks for the suggestions - will follow from now on. Here's one way to post the sample data, given the CREATE TABLE statement you posted earlier:
-- Basic data:
INSERT INTO tab1 (id, name, parentid) VALUES (1, 'X', NULL);
INSERT INTO tab1 (id, name, parentid) VALUES (2, 'Y', 1);
INSERT INTO tab1 (id, name, parentid) VALUES (3, 'Z', 2);
INSERT INTO tab1 (id, name, parentid) VALUES (4, 'A', 3);
-- To test branching (i.e., multiple children for the same parent):
INSERT INTO tab1 (id, name, parentid) VALUES (11, 'P', 1);
INSERT INTO tab1 (id, name, parentid) VALUES (12, 'Q', 1);
INSERT INTO tab1 (id, name, parentid) VALUES (13, 'R', 12);Alternatively, you could post a WITH clause, as someone did above.
I am not clear how to use the LEVEL pseudo column. Should I just start from the root, find all paths up to the level I am looking for? Could you please give me the syntax? Sorry, I'm still not clear what you want, or why you want it.
Do you want 4 because 'A' is the 4th generation in this family tree (that is, because 'A' has 3 ancestors), or do you want 4 because id=4 is on the same row as name='A'? In the former case, use LEVEL; in the latter, use the id column.
This query shows both:
SELECT SYS_CONNECT_BY_PATH (name, '/') AS name_path
, LEVEL AS lvl
, id
FROM tab1
START WITH parentid IS NULL
CONNECT BY parentid = PRIOR id
;Output from the expanded sample data:
NAME_PATH LVL ID
/X 1 1
/X/Y 2 2
/X/Y/Z 3 3
/X/Y/Z/A 4 4
/X/P 2 11
/X/Q 2 12
/X/Q/R 3 13
Similar Messages
-
How to find a concurrent request's responsibility of the FND user
How to find a concurrent request's responsibility of the OA user who submitted?
For example, I have a concurrent request id: 123, I know user A submitted,
I want to know user A's Responsibility when submitting the request id: 123.
ThanksHi,
I'm not sure about this, but can you check whether FND_CONCURRENT_REQUESTS.RESPONSIBILITY_ID provides you with the RESPONSIBILITY_ID of the user from which the request is triggered ? If yes, joining this with FND_RESPONSIBILITY_VL.RESPONSIBILITY_NAME can give you the name of the executing responsibility.
Regards,
Rakesh. -
How to find bpel instance in 11g based on the index values
We have 10g BPEL process where we define 4 index values for all the instances. Whenever support request comes, we ask index values and based on that we search the process instance.
We have migrated this 10g bpel process to 11g now. How to find bpel instance in 11g based on the index values ???I have multiple bpel in my composite. I checked in ci_indexes table and it shows the instance number of the bpel process. But the em console is showing only the composite instance number. when I opened composite instance, I could see all the bpel process with instance number in the audit trail. How can I find the the actual composite instance number that I should search for in the em console ???
-
How to find block free space and PCTUSED FOR THE TABLE
HI all,
Due to performance issues for my database , my management ask me to reset the PCTUSED and PCTFREE values , and my doubt is
1)How to find the current PCTUSED and PCTFREE values.
2)How to find block free space and PCTUSED FOR THE TABLE.
Please help me out regarding this.
Regards,
Vamsi.1)version is 10.2.0.4
2)output of query
tablespace extent_management allocation_type segment_space_management
SYSTEM LOCAL SYSTEM MANUAL
UNDOTBS1 LOCAL SYSTEM MANUAL
SYSAUX LOCAL SYSTEM AUTO
TEMP LOCAL UNIFORM MANUAL
USERS LOCAL SYSTEM AUTO
UNDOTBS2 LOCAL SYSTEM MANUAL
INS LOCAL SYSTEM AUTO
CONFTBS LOCAL SYSTEM AUTO
REINS LOCAL SYSTEM AUTO
ANALYST LOCAL SYSTEM AUTO
BI LOCAL SYSTEM AUTO
INTRFC LOCAL SYSTEM AUTO
COGNOS LOCAL SYSTEM AUTO
TS_INDX LOCAL SYSTEM AUTO
TS_CHOLAWEB LOCAL SYSTEM AUTO
TS_DASBOARD LOCAL SYSTEM AUTO -
Writing value in the parent curr adjs node of the value dimension
Hi,
Is it possible to write amount in the parent curr adjs node of the value dimension through rule. If yes, how
Thanks & Regards
mnrHi,
Is it possible to write amount in the parent curr adjs node of the value dimension through rule. If yes, how
Thanks & Regards
mnr -
C Programming: How can we get the filesystem name for a given file-path?
C Programming: How can we get the filesystem name for a given file-path?
Say I have a filepath=/mnt1/file1
Using some OS API like stat, can I get the Filesystem /mnt ?
Thanks in advance,
-VEnter the command up to the point of entering the file path and add a space, then drag the file into the terminal window. It will fill out the path.
If you need to go further into the contents of the Application package, you can continue with /Contents...
Another way is to start typing and then hit Tab to auto-complete. It will stop where it can't determine the next letter.
So, type /App tab and it will fill in /Applications. Type a / and start with the name of the app, then tab and it should complete. Continue till you have the correct path.
Spaces will be replaced with \<space>, so, App Store would end up as /Applications/App\ Store.app -
My Finder is not opening, it keep given the message "Finder app can't open anymore.
My Finder is not opening, it keep given the message "Finder app can't open anymore. This was after an upgrade from Yosemite 10.10.1 to 10.10.2. Below are reports from my console
2/7/15 13:11:13.337 Finder[206]: plugin com.getdropbox.dropbox.garcon interrupted
2/10/15 15:10:20.697 Finder[3559]: assertion failed: 14C109: libxpc.dylib + 97940 [876216DC-D5D3-381E-8AF9-49AE464E5107]: 0x87
2/10/15 15:10:22.657 Finder[3559]: Attempt to use XPC with a MachService that has HideUntilCheckIn set. This will result in unpredictable behavior: com.apple.backupd.status.xpc
Process: Finder [205]
Path: /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
Identifier: com.apple.finder
Build Info: Finder_FE-932001003000000~1
Responsible: Finder [205]
7 com.apple.finder 0x000000010389276e 0x1036ba000 + 1935214
8 com.apple.finder 0x0000000103963171 0x1036ba000 + 2789745
12 com.apple.finder 0x0000000103962664 0x1036ba000 + 2786916
14 com.apple.finder 0x000000010388f7b4 0x1036ba000 + 1922996
18 com.apple.finder 0x0000000103889168 0x1036ba000 + 1896808
32 com.apple.finder 0x00000001036bf960 0x1036ba000 + 22880
0x1036ba000 - 0x103ba8ffb com.apple.finder (10.10.1 - 10.10.1) <33C3024A-4A16-3485-B2B1-89FA33B9558A> /System/Library/CoreServices/Finder.app/Contents/MacOS/FinderFirst, quit "Dropbox" and see whether there's an improvement.
Finder crashes are often caused by "Google Drive." If it's installed, I suggest you first check for an update. If that doesn't solve the problem, remove it according to the developer's instructions. You may need to start the computer in safe mode to do so. Back up all data before making any changes.
If you use Google Drive and don't want to remove it, then try deselecting the option in its preferences to "show status icons." According to reports, that may be enough to stop the crashing.
Similar cloud-data clients such as "Dolly Drive," "iDrive," "Open Drive," "Transporter Desktop," and others can cause the same problem. -
How to find out if SQL execution plan is changed proactively using job/grid
Hello,
Can you help me on How to find out if SQL execution plan is changed proactively using job/grid control?
Thank you..
-The answers so far are supposed to show ways how to see that a plan changed after the fact - that is not really proactive but that was the question.
A way to see a plan change proactively would be to create a SQL Plan Baseline for the SQL statement with the 'good old' plan and then watch DBA_SQL_PLAN_BASELINES for new rows with that SQL_HANDLE which would indicate that a new execution plan was computed - although not yet used.
Kind regards
Uwe Hesse
"Don't believe it, test it!"
http://uhesse.com -
I want to gift a season that I have purchased. When I select the season I am not given the gift option, only "you have already purchased this season" Help....I'm trying to give Apple money here!
Another poster said that if you sign out of your iTunes Store account, go to the item you wish to gift, and select "gift" and go through the purchase process, it will then ask you for your account information and send the gift. I haven't tried this myself, but it's worth a go.
Regards. -
How do I tie an Code Interface Node to the dos command prompt or Windows FTP stuff
I have tried to use the System Exec.vi to do some ftp-ing with a box that If developing an automated ATP for. The sys exe vi dose most of what I need but not all. I can not modify the sys exe vi, nor can I copy the code interface node to another vi,I think that is because it has been compiled. So I need to generate my own vi that call the Windows ftp stuff or command prompt. I have spent several hours searching the NI site and the web in general and have not been able to find what to link the CIN to.
Can somebody please explain this to me?
I'm using:
LabVIEW 8.6.0
Windows XP Professional with service pack 3
Thanks
TeBluesYes this is related to the post of yesterday. I tried your suggestions yesterday and was unable to get any of them to work.
I down loaded the ftp library form OPENG and was unable to get it to connect to my box under test, and was unable to find any helping documentation on the OPENG site.
I down loaded the vi from the earlier post you referred to and do to my lack of knowledge of windows was unable to figure out how the incorporate it in to my vi. For example what is the "lpsz Window?
To complete this project I'm having to go deeper in to the stuff that goes on behind the seen than I have ever need before. So to me it looked like the next steep is to create a vi that used an CIN similar the the sys exe vi but add a few things around it..
If this is wrong, What do you suggest? Keeping in mind I do not have the internet tool kit and the project dose not want to purchase it if we can avoided it.
Thanks for your interest and time
TeBlues -
How to find bpel instance in 11g based on the index values using Java APIs
Hi ,
In SOA10G we had option to find the instances based on the index value using Java APIs like below.
WhereCondition criteria= new WhereCondition(SQLDefs.CX_index_1 + " = ?");
criteria.setString(1, "indexValue");
Locator mLoc = getLocator();
IInstanceHandle[] foundInstances = mLoc.listInstancesByIndex(criteria);
Please tell me how to achieve the same functionality in SOA 11G using Java APIs
Regards,
SabaI have multiple bpel in my composite. I checked in ci_indexes table and it shows the instance number of the bpel process. But the em console is showing only the composite instance number. when I opened composite instance, I could see all the bpel process with instance number in the audit trail. How can I find the the actual composite instance number that I should search for in the em console ???
-
ADF table: How to find out which rows were modified by the user
Hi,
I am using ADF table to display data that can be modified by the user (ReadOnly = false in the input text). I need to find out which rows were modified by the user, and only update (persist) those rows in the database.
Is there an easy way to find out which rows were modified by the user.
I am NOT particularly concerned with which columns were modified as I would update the entire row (if any data in that row is modified).
I am using Oracle JDeveloper version 11.1.1.3.
Thanks,
Ash KThanks Timo.
I am using ADF Data Control (which are created from Web Service proxy) to display/update the data.
In the backing bean, the operation that is invoked at the time persisting data is as follows:
public void commitOperation {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("operationA");
DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("someIterator");
for(int i=0; i<dciter.getViewObject().getEstimatedRowCount(); i++)
Row row=dciter.getRowAtRangeIndex(i);
SomeObject someObject= new SomeObject ();
someObject.setAttr1(row.getAttribute("Attrbute1").toString());
someObject.setAttr2(row.getAttribute("Attribute2").toString());
objectList.add(someObject);
operationBinding.getParamsMap().put("param1", objectList);
ResultObject result = (ResultObject) operationBinding.execute();
Inside the for loop (or any other place in the backing bean), I would like to figure out if the row was modified by the user. Please let me know if how to get that. If ADF provides this automatically, that would be GREAT.
Thanks,
Ash K -
How to find out if I navigate out of the page
Dear gurus,
I need to replicate ‘Warn about changes’ functionality in a certain case.
In my case page A displays view object VO1 in a tabular form, each record having a link in column ‘type’ that takes navigation to page B.
On page B the user changes the type to a new value using a pick list and submits a page B, then clicks Apply button that takes him back to page A with the new value for type brought from page B.
Now page A has a new value for type. Not committed yet. I need to show a warning popup message (similar to seeded ‘Warn about changes’ message) if a user navigates out of page A now.
I am thinking about using javascript to show the popup message. I will use the condition whether VO1 is dirty or not. But I don’t know how to track the fact that I navigated out of page A. Does anybody know how to find out is navigation out of the current page did occur?
Thank you
AnatoliyHi,
as there are links on the table from where you are navigating...set the fireaction property to fire an event say
"click". grab that event in contoller.
Controller code:
String name = (String)pageContext.getParameter("event");
if("click".equals(event))
this means you are navigating out of page A.
now invoke a method in AM to check if VO is dirty or not and if it dirty then throw an exception on page rather than pop_up.
String check = (String)am.invokeMethod("checkvodirty");
if("dirty".equals(check))
throw new OAException("The Transaction is dirty",OAException.ERROR);
else
navigate to page B using pageContext.setForwardurl().
In AM you can write :
public String checkvodirty()
sapeEAAddressesVOImpl addr = getsapeEAAddressesVO1();
String test = "";
if(addr.isDirty())//this checks that VO is dirty
test = "dirty";
else
test = "notdirty";
return test;
Thanks,
Gaurav -
How to find most cost-effective fwdg agent at the time of shipment creation
Dear Friends,
I have a requirement of realizing the best cost effective transporter(forwarding agent) in the shipment document. Then how to do using the Transportation functionality of the ERP?
There is a scenerio like I want to transport my goods from L to M. In system say i have a route XX for that, which gets automatically determined in the shipment document.
Now on route XX, if i have 5 operative transportors, say A, B, C, D, E.
Transporter A - provides services km-wise, kg-wise, fixed price as well as truck wise
(Say if you opt for km-wise, charges are 15 rs/km, 10 rs/kg, fixed price of 15000 for full truck from A to B)
Transporter B - Similar to Transporter A with different charges
(Say if you opt for km-wise, charges are 18 rs/km, 7 rs/kg, fixed price of 14500 for full truck from A to B)
Similarly other tranporters also have their charges.
and Now at the time of shipment creation, how can i have some standard method, so that the system suggest the most cost effective transportor for my delivery ie. shipment i want to make or probabaly if there is some standard way to get the list of all available transporters on a given route at the time of shipement creation.
Please suggest.
Regards,
Dipti.Hi Sandeepan,
Thanx for ur reply.
As per my requirement, there might be say 100 routes existing into the system and each route might have say 10 different transportors available. Now they want to know 1) the list of transportors available on the given route - (run time at the time of shipment creation) to be put into the forwarding agent field 2) Of the available (say 10 transportors) who will be the best/cheapest.
As per your suggestion, the functionality helps after we put in the fwdg agent and then estimate his associated cost. But as in this case, since there are so many routes (associated so many transportors) they will not know whom to put in the field.
Hence want to know if there is some standard functionality of SAP which might help us i) identifying the list of transportors on a particular route or a given criteria - run-time ii) How to find the best among available OR i) SAP Directly suggesting the one and best transportor available on a given route.
Please help.
Regards,
Dipti. -
How to find from which table we r fetching the data
Hi friends,
i got a requirement to design a query,in my transfer rules i check the info object related to the fiels.but in my crm the field name is different.
how to find from which table the field is fetched........
please tell me........
Regards
sridathDear Sridath,
In ST05 switch on the SQL Trace.
Goto RSA3.
Give your DataSource name > Execute
Goto ST05...Switch OFF the Trace
Analyze the Trace file
Gives you details about the fields and Tables from where you are fetching.
OR
Goto LBWE
Find your DataSource > Maintenance > Display mode
In right side window...expand ALL list box...
Exclude MC and take other words...they are the Source Tables.
Regards,
Ramkumar.
Maybe you are looking for
-
Creation of a root organnization.
Hi , We creat root organization structures via the transaction PPOCE. Now i have to create these org structures Programatically.. Are there any standard Function modules which can be used ? . Also i need to create a new position underneath it . Ple
-
I was listining to music then i paused my music and sat my ipod on my bed, when i cam back less than 15 minutes later my ipod was off, i tried to turn it on but it wouldnt come on so i put it on charger and its been on charger unresponsively for 2 da
-
Master-Detail and Detail-SubDetail navigation.
Hi! I am facing an issue regarding navigation in a second (subDetail) level child table. I have Master-Detail-subDetail like lilnks of three VOs. I have created 2 VLs for Master-Detail and Detail-SubDetail. Now on my custom page, navigation is fine f
-
Is the Iphone 5 model A1429 (CDMA) and model A1429 (GSM) the same phone?
Apple is inconsistent on their information for the iphone 5. One the LTE info site (http://www.apple.com/iphone/LTE/) it lists three different models, specifically showing that there is both a GSM and CDMA version of Model A1429. However, on the ipho
-
Not able to acess forms server
Hello, I installed the Weblogic server 10.3 & froms & reports 11g sucessfully, I able to run http://Forms11g:7001/console & http://Forms11g:8888/forms/formservlet after restarting i am not able to start any of them so i do the following things 1) .ba