How to use SYS_CONNECT_BU_PATH to get max(level)?
This is the example from
http://otn.oracle.com/products/oracle9i/daily/oct04.html
How can I modify this query to get the max(level)?
This query displays all levels 1, 2, 3
SELECT employee_name, LEVEL,
SYS_CONNECT_BY_PATH(employee_name, '/') "PATH"
FROM employee
START WITH employee_name = 'KING'
CONNECT BY PRIOR employee_id = manager_id;
This query returns the employee name and the management chain for each employee starting with the employee 'KING.' The results, using the same values shown in the first example, would look like:
EMPLOYEE_NAME PATH LEVEL
King /King 1
Greenberg /King/Greenberg 2
Faviet /King/Greenberg/Faviet 3
Chen /King/Greenberg/Chen 3
Sciarra /King/Greenberg/Sciarra 3
Urman /King/Greenberg/Urman 3
Popp /King/Greenberg/Popp 3
My question is -
How can I modify this query to get the max(level)?
ie - only these records -
Faviet /King/Greenberg/Faviet 3
Chen /King/Greenberg/Chen 3
Sciarra /King/Greenberg/Sciarra 3
Urman /King/Greenberg/Urman 3
Popp /King/Greenberg/Popp 3
sql>select level, sys_connect_by_path(e.ename, '/') path
2 from emp e
3 where level = (select max(level)
4 from emp
5 start with mgr is null
6 connect by prior empno = mgr)
7 start with mgr is null
8 connect by prior empno = mgr;
LEVEL PATH
4 /KING/JONES/SCOTT/ADAMS
4 /KING/JONES/FORD/SMITH
2 rows selected.
sql>select level, sys_connect_by_path(e.ename, '/') path
2 from emp e
3 where level = (select max(level) - 1
4 from emp
5 start with mgr is null
6 connect by prior empno = mgr)
7 start with mgr is null
8 connect by prior empno = mgr;
LEVEL PATH
3 /KING/JONES/SCOTT
3 /KING/JONES/FORD
3 /KING/BLAKE/ALLEN
3 /KING/BLAKE/WARD
3 /KING/BLAKE/MARTIN
3 /KING/BLAKE/TURNER
3 /KING/BLAKE/JAMES
3 /KING/CLARK/MILLER
8 rows selected.
Similar Messages
-
How to use error table in mapping level?
Hi all
Any one please tell me how to use error table in mapping level or how to handle the errors in mapping.
I am creating one error table in oracle but i dont know how to use it in mapping.
Thanks in advance.
KumarHi Kumar,
You need to use Error Table along with the Data Rule .
Error tables are used with Logical error handlers (Data Rules). Detailed description on using data rules is explained in the following document
http://www.oracle.com/technology/products/warehouse/pdf/OWB10gR2_ETLandBusinessRules.pdf
In a nut shell usage of error tables is as follows.
1. Create a data rule associate it with a table (Target table or table in which you load data).
2. Use the table in a mapping as target table.
3. Deploy the table and mapping.
Now in the target schema one more table will be created with the name <target table name>_ERR. When a mapping is executed the data which violates the data rule gets into this error table.
The following has to be done to have error table name of customers choice.
1. Right click on the table and click configure.
2. Give the table name in "shadow table name" section.
3. Deploy the table.
4. Use this table in a mapping. Now in the mapping on this table properties in "Error Table Name" section the name of the table specified in "shadow table name" will be populated.
Thanks,
Sutirtha -
How to use reflection to get base classes protected field
I have one base Base classes which have protected fields and public get method to get the field.
class Base
protected int proField;
public int getProField(){return proField;}
Class Derive extends base class Base
class Derive extends Base implements OtherInterface
public void funtion(){};
Now I have an instance of Derive, how can I use reflection to get the protected field inherited from Base. It seems Java Reflection only give runtime accessibility to public field and decleared field, protected-inherited field is excluded.
Thanks
Leias the last poster said, traverse up the class hierarchy.
ex:
private void doSumfinToField(String fieldName throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException {
Class clazz = getClass();
Field field = findFieldInClass(clazz, fieldName);
//field.doSumfin;
private Field findFieldInClass(Class clazz, String fieldName) throws NoSuchFieldException {
try { // to find the field in this class
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
// if we don't have a superclass, continue
if (clazz.getSuperclass().equals(Object.class)) {
throw e;
// check in the superclass
return findFieldInClass(clazz.getSuperclass(), fieldName);
} -
How to use Solve Order in Dimension level formula
Hi All,
Can anyone explain me how to use "Solve order" in formulas defined in dimension?
Regards,
KapilHi,
Let us consider the following:
There are 3 members in your account dimension, Amt, Rate, and Prod. The data looks like
Jan Feb Mar Apr May
Amt 100 10 20 30 40
Rate 10 20 10 20 30
Prod 1000 200 200 600 1200
The above values of the Prod will be displayed if the measure in CV is set to periodic. However, if you change the measure in CV to YTD and change the time dimension to dec, then you should get the below result.
Dec
Amt 200
Rate 90
Prod 3200
This value is nothing but the total of the entire year.
Hope this helps. -
How to use PDPageEnumContents to get PDText?
Please help me to use PDPageEnumContents to get PDText, the callback and PDGraphic confused me. I donnot know how to write. I am a green hand in Plugin Development.
Thank you.
Jason WangThis is an obsolete method. It should no longer be used.
Aandi Inston -
How to use sdk to get the image in the pdf file created by illustrator?
I have some pdf files create by illustrator and saved as pdf documents,
now I want to use the sdk to get the image in pdf files.
how to?
Thanks.Thank you first!
Yes,you are right,since I am new to illustrator,and I want to try to write a plugin,
I have read the sdk doc and API and opened the sample in vs2010,but no idea about how to operate the pdf doc in illustrator with api.
Hope more advise or any examples,thank a lot. -
I am new to iPad and have downloaded the Nook app. How do I use it to read the Nook books are that in my account from Barnes&Noble?
From http://www.barnesandnoble.com/ebooks/help-faqs.asp#NOOKapp
How do I download my books to my device? I get a message "Safari cannot Download".Launch the NOOK app software to trigger the automatic syncing of your purchases to your device. You can also manually tap the 'gear' button in the lower right-hand corner of the navigation bar and then hit Account Settings. This will open a screen to allow you to enter your login information which includes your account name and password. Press Go and your information will be verified and then the contents of your on-line NOOK Library will be listed for you. Then just browse your book listings and tap on the book you'd like to download to your device. A popup will confirm your request. Press OK and the book will download to your device in the background, and you'll be notified when it has finished downloading. -
How to use script to get the first table row on each page?
I create a print form to display a table. I set a conditional page break on this table, so the table rows on each page could be different.
For example, there're total 50 rows in this table. On the 1st page, there're 5 rows, but on the 2nd page, there're only 2 rows, and so on...
Now I want to get some value from the 1st table row on each page. How can do that? I can refer to a table row using TableRow[n], but I don't know how to calculate 'n' in script (either FormCalc or JavaScript) for the 1st row on each page.
Any ideas?Hi Wei,
There is an option of setting the overflow header in the pallette. You may check that out. It is basically used to have the table header to be seen in all pages, if the table is overflowing to multiple pages. You may put your first row as the overflow header.
- hope this helps, Kindly update,
thanks and regards,
- anto. -
JNI: How to use FindClass to get a class in a Jar file?
Is it possible to use the FindClass method of the JNI environment object to get a class that is in a jar file? My sample application was working when my class files were in the local directory. Now that I have replaced the class files with a jar file containing the classes, the app no longer works. I'd appreciate tips from anyone who knows how to do this.
-AndreasIs it possible to use the FindClass method of the
JNI environment object to get a class that is in a
jar file? My sample application was working when my
class files were in the local directory. Now that I
have replaced the class files with a jar file
containing the classes, the app no longer works. I'd
appreciate tips from anyone who knows how to do this.It has nothing to do with JNI.
The method uses the class path just like any other class loading situation in java. The reason it worked before is because your class path included the directory. It doesn't work now because either the jar is not in the class path or there is something wrong with the class path. -
How to use MAP to get CALs license
i want to use MAP detect CALs license on windows sever, exchange, SQL sever. can i use MAP to detect, how?
See the Getting Started Guide for a list of supported server products for getting CAL info. For Windows Server, SQL Server, and SharePoint Server CAL info you need to enable logging on the supported servers and then import and parse those logs after they
have been collecting the data for long enough. We recommend 90 days but you can work out the amount of logging that will be acceptable with your licensing professional. You can read how to configure the event logging in Section 1 of the Getting Started Guide.
Exchange, SCCM, and Forefront Endpoint Protection will have data without importing logs by simply choosing those inventory scenarios in the wizard.
Please remember to click "Mark as Answer" on the post that helps you, and to click
"Unmark as Answer" if a marked post does not actually answer your question. Please
VOTE as HELPFUL if the post helps you. This can be beneficial to other community members reading the thread. -
How can use removal rate to show level of liquid in a tank?
I'm trying to use a use a flow meter to measure the usage of oil in a home heating system. I've set up a VI to measure the frequency of the flow meter and convert it into l/hr. The problem I have is how can I use this data to show the liquid level in the tank disipating as the flow meter runs?
See diagram below....
ChrisHi Chris,
I hope you are well.
Ravens Fan is right, Shift Register would be the easiest way of implementing this into your code.
I have included a link to a Developer Zone article which explains Shift Registers under the Iterative Data Transfer section.
Tutorial : Timing, Shift Register and Case Structures
Video : Timing, Shift Register and Case Structures
Basic Shift Register examples
Have a good weekend!
Ashish Naik
Field Sales Engineer
National Instruments UK -
How to use JFileChooser to get filename of mutifile???
Hi,
I tryed to use JFileChooser to open multiple files and I want to save name of selected files in to array of String
I have writen some code but it doesn't work
My question is how can I get the filenames as a string array from
"getSelectedFiles". Any comments are highly welcomed! Thanks a lot. If yes pls give to me some code
Nguyen Thanh Bahope this will help
http://java.sun.com/developer/JDCTechTips/2004/tt0316.html -
How to use apdu to get the certificate in smartcard?
hi,guys
how could i use the apdu command to get the certificate in smart card.
now i sent following commands in JCOP shell
/send 00a404000cA000000063504B43532D3135
/send 00a4000c023f00
/send 00a4000c025031
/send 00a40200024404
/send 00b0000080
/send 00b0008080
what's the next step?i'm using the A.E.T's safesign card,i just only use the apdu to load from card.
but it's seems like it's can't load whole certificate. -
How to use SPMetal to get the item's original field which named 'Created'
I want to read the field which named 'Created' by using SPMetal,I found the 'Item' class has the property named '_originalValues', it seems to get the infomation about the original values.
Is there anyone who has solved this kind of problems?Hi,
By default, the Created, CreatedBy, Modified and ModifiedBy fields are not created by SPMetal, so we will need to extend our base entity class for accessing these fields in our
code.
Here is a link will show how to achieve this with steps in detail:
http://weblogs.asp.net/uruit/archive/2011/05/05/linq-to-sharepoint-working-with-created-createdby-modified-and-modifiedby.aspx
Best regards
Patrick Liang
TechNet Community Support -
How to use G_SET_GET_ID_FROM_NAME to get set id
hello gurus,
i am having a set defined as CL-BOOK-DOC-TYPE which contians accounting document type
i want to read the set values in my program using the function module G_SET_GET_ID_FROM_NAME but when i try to pass this set value i am not getting any set values am i missing any key fields
regards
afzalself solved
Maybe you are looking for
-
How can I use the QR codes with my iPad 2. do I need to download first an app ?
How can I use the/read the QR codes with my iPad 2 ? Do I need to download an app ?
-
HCM Processes and Forms - Confirmation Text Formatting
Hi All, I am attempting to use the Confirmation Txt in the Scenario Steps of a form. When the editor comes up, there are not options for formatting available. According to the help system, the text editor provides you with XML formatting options as b
-
Database Primary Key Question - Best Practices
I posted this in the ADDT forum, but I imagine I'll get more responses here: All you database developers - how do you deal with primary keys? Do you ALWAYS use an AutoIncrement/AutoNumber? Or only sometimes? Is there an argument to NOT use AutoIncrem
-
When will Adobe Application Manager does not list Premiere Pro?
Hi, I'm trying to install Premiere Pro for the Creative Cloud but I can not get past the Application Manager. Is there another way to install it?
-
RAC running with 3hrs gap among nodes
Hello Gurus, We are in a very strange situtaion. We are running our system on 3 node RAC.The OS is RHEL 4 update 5 64 bit.The database is 10.2.0.4 with oracle clusterware. The problem is that the the 3rd node has it's time set as 3 hrs ahead of first