CHANGE THE LEVEL NUMBER IN AN SQL QUERY

Hi
I've this query:
SELECT LEVEL,LPAD(' ',(LEVEL+1)*5,' ')||ENAME ENAME
FROM EMP
START WITH MGR IS NULL
CONNECT BY PRIOR EMPNO = MGR
the result is:
LEVEL ENAME
1 KING
2 JONES
3 SCOTT
2 FORD
3 SMITH
my question is that if i except FORD how can i change the level number to SMITH from 3 to 2.
for example:
SELECT LEVEL,LPAD(' ',(LEVEL+1)*5,' ')||ENAME ENAME
FROM EMP
WHERE ENAME <> 'FORD'
START WITH MGR IS NULL
CONNECT BY PRIOR EMPNO= MGR
the result is:
LEVEL ENAME
1 KING
2 JONES
3 SCOTT
2 SMITH
regards
nadia

Hi,
If you notice the level of SMITH is 4 in the initial query but when you exclude FORD, then SMITH is taking up his level i.e., 3.
SQL>     SELECT LEVEL lvl, ENAME
  2      FROM EMP
  3      START WITH MGR IS NULL
  4      CONNECT BY PRIOR EMPNO = MGR;
       LVL ENAME
         1 KING
         2 JONES
         3 FORD
4 SMITH
         2 BLAKE
         3 ALLEN
         3 WARD
         3 MARTIN
         3 TURNER
         3 JAMES
         2 CLARK
         3 MILLER
12 rows selected.
SQL> Select decode(ename, 'SMITH', lag_level, lvl) dec_lvl,
  2      ename from (
  3      SELECT rownum rn, LEVEL lvl, lag(level) over (order by level) lag_level, ENAME
  4      FROM EMP
  5      START WITH MGR IS NULL
  6      CONNECT BY PRIOR EMPNO = MGR )
  7      Where ename <> 'FORD'
  8      order by rn;
   DEC_LVL ENAME
         1 KING
         2 JONES
         3 SMITH
         2 BLAKE
         3 ALLEN
         3 WARD
         3 MARTIN
         3 TURNER
         3 JAMES
         2 CLARK
         3 MILLER
11 rows selected.
SQL>Regards

Similar Messages

  • Changing database credentials of action block SQL Query

    Hi,
           I have created a SQL Query with command mode for inserting data in database. But I would like to change the database credentials of this SQL Query dynamically. How can I do this? I have seen one property of this action block as Connector. What is format of the value it expects. Can any one help me on this?
    Thanks
    Shaji

    Can you please specify exactly what you're trying to do?
    You mention credentials in your subject line and earlier post, which to me would indicate that you might want your query activity to be done on behalf of the logged in user?  This was an option in 11.5 (no idea how often it was used, or what 12.0/12.1 do since the documentation is void of the setting) http://help.sap.com/saphelp_xmii115/helpdata/en/Connectors/IDBCConnector.htm#Capabilities 
    You would have to formulate an /XMII/Illuminator?QueryTemplate=xxx/yyyy type query to include these properties, since they are not applet or template parameters they won't show up in the link editor.
    The User / Pwd properties you see are not for this - they are leftovers from older versions for authenticating applets.

  • Change the level of isolation in a Informix connection

    Post Author: mibarz
    CA Forum: Data Integration
    Iu2019m working over informix and I need to change de level of isolation befor make a Query.
    The Informix instruction is SET ISOLATION TO DIRTY READ.  In the Data flow we are using the SQL statement object for retrieve the data.
    I try to change the level of isolation in the ODBC configuration, but its impossible.
    ¿Anybody can help me with this problem?
    Thanks,
    Martí

    Post Author: bhofmans
    CA Forum: Data Integration
    Unfortunately this is not possible in Data Integrator today. We have several enhancement requests for this and similar functionality for several RDBMS. For MSSQL server a workaround is provided via a DSConfig parameter, for other RDBMS we don't have a solution yet.

  • Changing the default number of rows displayed in a interactive report

    Hi,
    I have a sql query based interactive report but i cant change the default number of pages i.e 15.
    is there any way to change the number of rows displayed.
    Thank you,
    rakesh

    Hi,
    That was very useful document that you shared, yes that is correct we can so it this way but there is another way doing it where in if you go to the report attribute section and in that there is Layout and Pagination and under
    that you can fix the number of rows, and over there we can also accept values from page item such as if the page item value changes the number of rows displayed in the report changes dynamically.
    In my report i get only pagination but not a option for layout.
    Any help will be appreciated.
    And also where i can get the links to the similar document that you have shared ?
    TY
    rakesh
    Edited by: rakesh119 on Apr 30, 2013 12:10 PM

  • How to change the maximum number of process per user in BW ?

    Hi,
    Do you know how to change the maximum number of process allowed per user ?
    With RSRT we can customize the number of process per query but I don't know where we can customize the maximum number of process per user.
    In fact, my production environment reach always the max number of process available in SM50...
    Thanks a lot

    Hi,
    A user is not have the No. of processor but a work process can handle N No. of users. If a user hit any transaction v acn say from  a list of N worl proceesor which has been taken the work.
    Correct if I am wrong.
    Regards
    Syed.

  • Need to change the VAT number associated with my account.

    Hi, who do I have to ask for changing the VAT number associated with my account?

    Hi Calin ,
    I would request you to please get in touch with the Adobe Technical Team in order to get your query resolved. Here is the link for the same.
    https://helpx.adobe.com/adobe-connect/kb/connect-chat-support.html
    Regards
    Sukrit Dhingra

  • I can not view ANY videos on Vimeo, I have 'reset' the Ipad, original IOS 5, cleared the history and cookies, I have changed the DNS number to 8.8.8.8, I have worked on this for 2 days and still can't find a fix, HELP!!

    I can not view ANY videos on Vimeo, I have 'reset' the Ipad, original IOS 5, cleared the history and cookies, I haves changed the DNs number to 8.8.8.8, I have worked on this for 3 days now, HELP!!!!

    Try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps BEFORE doing the reset.

  • I am trying to connect to FaceTime and I message on my ipad 2 but it wouldn't connect!Changing the DNA number is not working. Any ideas?

    I am trying to connect to FaceTime and I message but I am getting a message check my network setting.i tried changing the Dns number but it's not working.Any ideas

    Do other USB devices work on your MBP?
    Does this USB stick work on other MBPs?
    There is a possibility that the stick requires more power than the MBP delivers.  Try it on a powered hub.
    Ciao.

  • HT1918 I am unable to locate where to change the phone number that is associated with my itunes account.

    I am unable to locate where to change the phone number that is associated with my itunes account.  I have a new number and the old number is no longer accessible by me.  I've logged into my iTunes acct and it seems I can only change my appleID itself, my billing address info, and password and things like that.  I cannot find where to remove a number and add a new one.  I've gone to my mobile devices (iphone, ipad) as well as my mac and I'm getting a bit frustrated with it.  I'm sure there's a simple solution and I'm just missing it.  Going to settings>messages>send&receive....there is the old number and no option to make a correction.  I've unchecked it but why can't I add the new number?  On my iphone the ONLY option that shows up is my current number but when I set up my new ipad I have the issue described here.  I want this number completely removed from my account there has to be a way to get it out of the system.  
    Also when going to settings>facetime>you can be reached at:  shows email addresses as well as the OLD phone number with no option to make the correction, remove the incorrect number, or add a new number.  I figured this was tied in to my appleID since thats when it showed up (right when I signed in on my ipad).  So I went to itunes on my mac and went to my account and there I find AppleID Summary, itunes in the cloud, purchase history, and settings.  I've gone through each of those and am still unable to figure out where to change it.  Somebody PLEASE tell me where to find this data so I can change it.  I've seen multiple inquiries about this all over the internet but everyone's solution is to do exactly what I've already done.  No resolution to the real issue. 

    Apple will have it, but if there is ever a question/problem, the store that you made the exchange at will have it on record. 
    But if you're worried about it call 800-APL-CARE and see if they have it.

  • HT5622 My husband and I share the same apple id for our iphones, how do we change the phone number associated with our apple id to his phone number? He is getting my messages because the ipod has my number in it not his?

    My husband and I have iphones that use the ame apple ID, but different numbers and email addresses, how do we change the phone number that is associated with his ipod to his phone number?

    Use his ID for Settings>Messages>Send And Recieve and for Settings>FaceTime.
    If he does not have an ID then
    Create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card

  • How do I change the phone number that ipad is using for iMessage and FaceTime

    Since the latest iOS update my ipad uses my husbands phone number for iMessage and FaceTime. How do I change the phone number to match my iPhone?

    Sign out of FT and iMessage on both your iPad and your iPhone. Sign back in on the iPhone. Wait for everything to activate. Then, sign back in on the iPad using the same Apple ID.

  • How do I change the phone number on imessage?

    I just updated to ios 6 and the update for mountain lion. What i cant seem to do is change the phone number on imessage from my wifes to mine on my personal mac pro. How do i do that?

    Hi,
    In the first Instance Messages allows you to Call from the Contacts list.
    On the second hand iCloud will sync your Contacts to the iPhone.
    If your My Card in the Contacts (Head and Shoulders iCon) then you  will not be calling your own iPhone or it will not be listed as the phone number in the iOS 6 and OS X 10.8.2 update changes.
    10:36 PM      Wednesday; September 19, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • HT3965 how do i change the phone number for imessages?

    how do i change the phone number for imessages?
    i have set up an iTouch for my 10 year old son. To set up iMessaging between him and his parents i used my iTunes account but this picked up my phone number..........i now need to change this but cannot see how to do it in Settings. Any suggestions?

    Thanks, but i guess this means i have to create an email address for my son and hs own apple id?
    My aim is to link his mobile number to the iTouch but not to give him his own iTunes account....

  • How do I change the phone number associated with imessage

    somehow, my daughters cell iphone number is the number associated with my i-message account on my ipad. How do I change it to MY cell i-phone number?  The email address and password are correct, and I can see how to add another email address, but not how to change the phone number. Thanks.

    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage - Apple Support

  • How do I change the phone number used for iMessage on iPad 4

    I want to change the phone number used on iMessage on iPad.  Any help?

    It's best to use an email address (gmail.com?) for FaceTime and iMessage on your iPad.
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    For non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
     Cheers, Tom

Maybe you are looking for

  • Update Routine ... Help me Please--VERY URGENT

    Hi All , I Moving data from Cube to ODS . Let me explain abt the records in the cube . There are 6 key figures in the cube as well as dimensions, UNIQKEY TRANSACTION is One Dimension and ARTICLE is another dimension which is having an Navigational at

  • Using a View multiple times in a Window

    Hi, In my default  view I've got a tabstrip with 3 tabs. I've created 3 different view containers elements in each tab as I want to embed another view (ie VIEW_1) in these containers. However, I'm getting the following error. View VIEW_1 Is Already D

  • Documentation with examples for OO ABAP

    Hi All out there, I want to learn object oriented ABAP. can you send me some documentation along with examples to [email protected] Thnanks in Advance. Ashutosh.

  • How can I change the startup location if sunstudio?

    Hello all when I start the sunstudio it creates me the .sunstudio directory in my $HOME dir , how can I change it so it will create me the .sunstudio directory in different place the reason I have no space left in my $HOME dir and I have some space i

  • HT1414 how do i update itouch second generation to latest OS software?

    I have a iTouch second generation (i believe) and the current soft ware is 3.1.3. I attempted to update via iTunes to the latest software but I receive an error message. I went through the tutorial steps and haven't made any progress. Has anyone had