Not able to understand the query logic

Hello

Please, help me to understand the logic of the query below.


I have an emp table having 2 emp_id and mgr_id column.

data from table.

emp_id mgr_id
1
2 2
3 3
4 5
5
6 5
6 of 7
6 of 8
9 7

I run the query below...

Select * from emp where emp_id not in (select mgr_id from emp);

Query giving no line.

I need to know the logic of the query.

Thank you
HIMS

Because there are some NULL values in the column so 'IN' mgr_id would fail to compare values such as 1,4,8,9 which are not there in mgr_id with these NULL values.

Use NVL like below to get the desired results...

 

with t as
( select 1 emp_id,  null mgr_id from dual union all
  select 2,2 from dual union all
  select 3,3 from dual union all
  select 4,5 from dual union all
  select 5,null  from dual union all
  select 6,5  from dual union all
  select 7,6  from dual union all
  select 8,6  from dual union all
  select 9,7  from dual
)
SELECT *
  FROM t
 WHERE emp_id NOT IN (SELECT nvl(mgr_id,0) from t );

Concerning
Arun

Tags: Database

Similar Questions

  • Not able to find the query

    Dear all,

    I have a request from 10g to oracle HRMS attendance table.

    My requirement is that I need to get the latest information used without reducing the number of employees.

    A          B     C     D               E

    683162670.527/04/201527/04/2015
    691322612008/12/201531/08/2015
    69132361309/01/201509/03/2015
    70028661109/04/201509/04/2015

    Here's my query:

    Select min (date_start) leave_from, max (date_end) leave_to, to_number (sum (absence_days)) days

    of per_absence_attendances paba

    where paba.person_id =

    select (separate ppf.person_id

    of ppf, paf per_assignments_f per_people_f

    where ppf.person_id = paf.person_id

    and ppf.employee_number = '11190'

    )

    and date_end > = all (select date_start-1 in per_absence_attendances where person_id = paba.person_id)

    Output for the above query:

    09/01/201509/04/20154

    Here, I'm able to get the last 2 records, but my requirement is like a continuous vacation, I'm supposed to get the last 3 records.

    08/12/201509/04/201524

    Please can someone help me get this.

    Thank you

    with

    as example

    (select date ' 2014-12-01' date_from, date ' 2014-12-10' date_to of all the double union)

    Select date "2015-06-01,'date ' 2015 - 06 - 10 minutes of union double all the"

    Select date "2015-08-15', date ' 2015-08-31 the Union double all the"

    Select date "2015-09-01,'date ' 2015 - 09 - 10 minutes of union double all the"

    Select date "2015-09-11,'date '' 2015-09-11 of the double"

    )

    Select min (date_from) leave_from, max (date_to) leave_to, sum (days) days

    (select date_from, date_to, days,

    Sum (SOG) during grp (date_to order),

    Sum (SOG) on last_grp (order by date_to lines between unbounded preceding and following unbounded)

    from (select date_from, date_to, date_to - date_from + 1 days,

    -case when lag(date_to,1,date_from) (date_to layout order)! = date_from - 1

    then 1

    end from sog

    example

    )

    )

    where PRV = last_grp

    LEAVE_FROM LEAVE_TO DAYS
    15/08/2015 11/09/2015 28

    Concerning

    Etbin

  • Not able to change the password by using the query. Select APPS.fnd_web_sec

    Not able to change the password by using the query.
    Select APPS.fnd_web_sec.change_password ('username', 'password') 'RES' double;

    Can someone tell why and what privileges and subsidies have flexibility to the user non-apps while it can change the password using fnd_web_sec.change_password.



    Concerning

    the information above does not solve my problem, I get the message

    Because you do not have permission on all objects that are referenced by the API (see below).

    Select FND_WEB_SEC. CHANGE_PASSWORD ('MARSHAD', 'mohammad @123') "RES" of the double

    *

    ERROR on line 1:

    ORA-00942: table or view does not exist

    ORA-06512: at the 'APPS '. FND_CORE_LOG', line 25

    ORA-06512: at the 'APPS '. FND_CORE_LOG', line 432

    ORA-06512: at the 'APPS '. FND_PROFILE', line 110

    ORA-06512: at the 'APPS '. FND_SSO_MANAGER", line 227

    ORA-06512: at the 'APPS '. FND_WEB_SEC', line 1425

    ORA-06512: at line 1...

    can you please list me what are the grants and other Jules Destrooper I should give to a user so that he can change password.

    I don't have the list of objects and you should get yourself by consulting the site code and eTRM API.

    by changing the DDT in the user non-apps after the grant, will, it may be able to change the password.please tell this syntax is correct or not.
    Select applications. FND_WEB_SEC. CHANGE_PASSWORD ('user', 'pwd') "RES" of the double

    What is the point of using 'FND_WEB_SEC. CHANGE_PASSWORD' and not FNDCPASS or FND_USER_PKG API?

    Thank you
    Hussein

  • Not able to check the upgrade - Windows 8

    Original title: updates

    A blue bar keeps coming back, it says: Windows needs your help: so he said windows update was not able to verify the new updates for the last 30 days. Go to windows update to fix the problem. I tried all the ideals? This bar keeps coming back every 15 seconds, I'm going to windows updates and it does not update.

    Hi Michael,

    Thanks for posting your query in Microsoft Community.

    I understand that you receive a blue bar to go the Windows updates to check for updates and install to keep the computer up-to-date, but it fails. I'll be happy to answer your query. Let me ask you;

    • What security software is installed on the computer?
    • Using proxy connection?

    This may be due to reasons various, such as the files required by Windows update is missing or damaged, connection proxy security, software, etc. Let's try the following methods and check the status.

    Method 1: Run the Windows Update troubleshooting tool

    1. Open the Windows Update troubleshooting tool by hitting swipe in the edge right of the screen, tap Search (or if you use a mouse, pointing to the top right of the screen, move the mouse down and then clicking Search), entering the Troubleshooting in the search box, by typing or clicking on settings then tapping or clicking on the resolution of the problems. Under system and security, tap or click fix problems with Windows Update.

    2. Run the troubleshooter, and then open Windows Update and try installing the update again.

    Method 2: Turn off the proxy connection

    Press Windows key + R, type inetcpl.cpl , and then press OK

    Click on the connections tab, and then click LAN settings

    Uncheck the option use a proxy server for your LAN

    Click OK

    Method 3: Disable security software

    Important: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attack.

    Method 4: Run the DISM tool

    1. Enter in the right edge of the screen and then click on Search.
      (If you use a mouse, point to the upper right of the screen, move the pointer of the mouse down and then click find.)

    2. Enter command prompt in the search box.

    3. In the results list, drag down on or right click command prompt, and then press or click run as administrator.

    4. In the administrator: command prompt window, type the following commands. Press ENTER after each command:

      DISM.exe / Online/Cleanup-image /Scanhealth

      DISM.exe / Online/Cleanup-image /Restorehealth

    5. To close the administrator: command prompt window, type Exitand press ENTER.

    6. Run Windows Update again.

    Hope this information is useful. Please feel free to answer in the case where you are facing in the future other problems with Windows.

  • am not able to use the keyboard Finns characters.how special use these special characters

    We bought a new acer laptop

    specifications of the laptop are as mentioned below >

    ACER ASPIRE S3 13.3 INCHES

     

    We are not able to understand how to enter some special characters using the key board, some characters are shown below

    a o a

     

    Could you please inform us about how this particular buttons might be enabled.

    Two methods:

    1. use the character map to select the character and copy/paste in your application

    2. change local/keyboard control/regions and languages/change keyboard that some keys are mapped to your special characters

    For more information, Google keywords above.

  • MBR is corrupted, not able to repair the MBR and get error code 0 x 490

    Original title: MBR is corrupted

    MBR is corrupt repair action: repair disk metadata - result: failed - error code = 0 x 490

    Hello

    According to the description, I understand that you are not able to repair the Master Boot Record (MBR) and getting the error is 0 x 490.

    I suggest that you want to run auto repair with installation media and see if it helps you repair system files or not. For the execution of the task, I suggest you to try the steps below and see if it helps.

    Method 1: Execution of restarting the Windows recovery environment (WinRE)

    To run the repair to start the Windows recovery environment (WinRE), follow these steps:

    1. Insert the Windows installation disc in the disc drive, and then start the computer.

    2. When the message press any key to start from the CD or DVD is displayed, press a key.
      If your PC does not automatically detect the media

    • When the computer reboots, read on screen for instructions that explain how to interrupt normal startup and access the basic input/output system (BIOS) configuration utility. Most PCs use the F2, F10, ESC or del key to start the configuration of the BIOS.

    • Looking for a tab in the BIOS configuration utility that is labeled boot order, The Options of Bootor Boot. By following the instructions on the screen, use the arrow keys to go to the boot order, and then press ENTER.

    • Locate the flash USB, DVD or CD player (this could be called removable device) in the startup list. By following the instructions on the screen, use the arrow keys to move the drive to the top so that it appears first in the startup list. Press ENTER. The startup command sequence is now changed to boot from the flash drive, CD, DVD, or USB.

    • Press F10 to save your changes and exit the BIOS Setup utility. Select Yes in the confirmation window. The PC will restart.

    1. Select a language, a time and a currency, a keyboard or input method, and then click Next.

    2. Click on repair your computer.

    3. In the System Recovery Options dialog box, select the drive of your Windows installation, and then click Next.

    4. In the System Recovery Options dialog box, click on repair your computer.

    5. Click the operating system you want to repair, and then click Next.

    In the System Recovery Options dialog box, click Startup Repair.

    For more information about System Recovery Options, see What are the system recovery options in Windows?

    For more information about the Startup Repair, see Startup Repair: frequently asked questions.

    If you are using Windows 7 then the link provided below might help you to download and create installation media.

    Download Windows 7 Disk Images (ISO files): https://www.Microsoft.com/en-us/software-download/Windows7?WA=wsignin1.0

    Method 2

    If the problem persists, try to rebuild the BCD by using the Bootrec.exe tool. To run the Bootrec.exe tool, you must start the recovery Windows (WINRE) environment . To do this, follow these steps:

    1. Place the Windows 7 installation disc in the disc drive, and then start the computer.

  • Press a key when you are prompted. Select a language, a time, a currency, a keyboard or an input method, and then click Next.

  • Click repair your computer.

  • Click the operating system you want to repair, and then click Next.

  • In the System Recovery Options dialog box, click command prompt.

  • Type Bootrec.exe, and then press ENTER.

    See the following link for more information:

    How to use the Bootrec.exe tool in the Windows recovery environment to troubleshoot and repair startup issues in Windows

    http://support.Microsoft.com/kb/927392

    Hope it would help. If problem persists always post back with the current state of your computer and the result of the proposed suggestion, we will be happy to help you.

  • Not able to use the graphics drivers

    Original title: NVIDIA GEFORCE 630 M - 1 GB

    Hi, on my computer laptop there are two small stickers, reads: NVIDIA GEFORCE 630 M - 1 GB, the other reads as follows: NVIDIA OPTIMUS TECHNOLOGY (autonomy - excellent performance).

    Now in Windows 7, I can go to the Control Panel - programs - uninstall a program. At this location it allows me to repair the programs too. At this point, I clicked on the following: NVIDIA GRAPHICS DRIVER 295.55, a box appeared in the middle of my screen entitled RunDLL. Inside of this box it read: there was a problem starting C:\program NVIDIA Corporation\Installer2\Installer.0\NVI2. DLL. the specified module could not be found.

    I tried Windows Update and also search and solve problems, but they did not work. On Google I found the NVIDIA site, but couldn't work out how to solve the problem, so any help would be appreciated.

    Thank you

    JIMOA

    Hello

    Please contact Microsoft Community.

    I understand that you are not able to repair the NVIDIA graphics driver, so let me help you on this question.

    Please answer the following questions so that I can better help you:

    1. why you try to fix the graphics driver?

    2. What number you are confronted with the graphics?

    3. have you uninstalled all programs before?

    I suggest to try the next step and check to see if it helps:

    NVIDIA Optimus technology intelligently optimizes your notebook PC, providing the outstanding graphics performance you need.

    Please visit the below mentioned link for more details:

    http://www.nvidia.com/object/optimus_technology.html

    You can download the latest version of the driver NVIDIA graphics from the link below:
    http://www.nvidia.com/download/driverResults.aspx/79528/en-us

    Please let us know if you need assistance, we will be happy to help you.

  • Windows Update was not able to verify the new updates for the last 30 days, go to windows update to resolve this problem

    Hi people

    I'm on Windows 8, and in these last days, I get this message

    " " Windows Update was not able to verify the new updates for the last 30 days, go to windows update to resolve this problem"

    It is on a blue banner that goes directly to the screen and it is very annoying

    I get updates through so I do not understand this

    Any help would be great

    PS I have tryied the restoration of the system, and it's always the same

    Lee was soon

    Original title: looking for some help please

    Hi Lee,.

    I had this same problem and it drove me crazy, but I solved it.

    I clicked on the link above that 'Shubham Chin"gave, and in this link all the topic, if you click on the topic" my PC is not responding all by searching for the or to install updates.

    below that it will then say "try to run windows update convenience store", click on that and it should get rid of this very annoying pop to the top and other problems with your laptop... hope I helped :)

  • Not able to install the application, asking family SMEs of installation

    Original title: iam not able to install the app it ask family SMEs of installation

    IAM able to install apps it ask some family configuration

    Hello

    Thanks for posting your query to the Microsoft forum. I will definitely help you with this.

    I would like to know;

    1. What you are trying to install applications?
    2. You are the administrator of your computer?

    You can set up a family safety account or you may be referred by the primary user. For the children of family security controlled, if game Restrictions are lit, depending on the setting you have (lower than 10, teen, mature etc), your child will be able to download applications that meet the coast.

    Here's what I suggest, if you wish to:

    1. Go to https://familysafety.microsoft.com and login as parent
    2. Check the setting of the game.

    You can do two things

    • Put out of the game restrictions or
    • Change the restriction of adult game

    Once your child has downloaded the application, parent go back to the family site, turn on the Restriction of game or set the game side to one appropriate for your child.

    For more information:

    Use security for the family with the Windows store

    Also, in the list of game for your childs account, make sure that the app is in the whitelist if your username already has but gets blocked by parental control due to permissions issue.

    Let us know if you need more assistance. We will be happy to help you.

    ________________

    Thank you best regards &,.

    Isha Soni

  • Not able to connect the second monitor

    Original title: Second monitor visible only on the first plugin

    Implementation:

    New (Nov 2014) Lenovo PC

    AMD A8 H535

    Windows 8.1

    AMD Radeon HD D 7560 w / VGA output and an HDMI output

    Two HP w1907 monitors (resolution is identical on both screens - when they work together)

    Question:

    Last night I plugged my second monitor to the HDMI output with an HDMI adapter / VGA of the Amazon ( adapter ), plug the monitor into it has not come and via the control panel (I tried both via the control panel and some change PC settings) could not detect the second monitor. Then, I went to the HP website and downloaded the drivers, but to no avail. Then I reached down and unplugged the second monitor and resettled to make sure that there is a link, this solved the problem. The monitor came and no further investigation was necessary. However, this morning I woke up the computer to a single monitor and still unable to detect the second monitor. Only when I unplugged and re-inserted the link it works.

    I'm at the end of my rope and need help with this, thanks in advance for any help you can provide.

    Hello

     
    I understand that you are not able to connect the second monitor to the computer. This problem may occur because of outdated or damaged display card drivers.
     
    So I suggest to follow the steps mentioned below and check if help them.
     
    Method 1
    Please check the steps mentioned in the link below to check that everything has been done correctly to connect the second monitor.
    Plug a second monitor or projector

    Method 2

    Install all Windows updates and check if it solves the problem. You can check the below link to do.
    Windows Update: frequently asked Questions
     
    If problem still persists, go to method 3.
    Method 3
    Uninstall and reinstall the display driver and check if it helps. First download the display driver and save it to the computer. You can download the latest driver to display from the link below.

    Uninstall the display driver, then reinstall it. Follow the steps
    mentioned below to uninstall:
    1. press Windows + R, type devmgmt.msc , and then click ok.
    2. now, find and click with the right button on the display driver and click Uninstall.

    Also install the catalyst for AMD. You can download it from the link below. http://support.AMD.com/en-us/download/desktop?OS=Windows%208.1%20-%2064

    Hope this information helps. Please get back to us if you need further assistance.

  • Not able to access the Console of the OAM?

    Hi all

    I am facing this problem while I try to connect to the console of the OAM, when the managed server is started I am not able to access the Console of the OAM, but when I stopped the managed server, I am able to access the Console of the OAM. Please guide me on this.

    I need documentation on how exactly the work of the Console of the OAM.

    Thank you

    SJ

    Hi Laura,

    Thanks for giving your valuable time, I was able to understand the question. LoadBalancer settings pointing to another machine where I had not installed OAM.

  • Not able to change the plan of the quality during the inspection of reception using the task of ACEM.

    Hi all

    I am not able to change the plan of the quality during the inspection of reception using the task of ACEM.

    Please suggest what to do on the priority.

    Thank you and best regards,

    Piyush Kudawalee

    Hello

    If you use functions much jump, then you must add a new plan of the quality in the settings of jumps.

    Please go to the root of quality > process lots Skip parameters > application process of Skip lot number attached to the elements > go to settings to jump > add plan new collection...

    This will show you the two quality LIMM and Oracle plans. You can add as many plans as you want and can restrict their in asigning to specific jump lot.

    The quality plan is failing because there can be only plan quality attached to jump a lot.

    NOTE: Please indicate the post as helpful or answered if the update has really helped you. This would also bring the wire to the logical conclusion and will be useful for viewers.

    Thank you

    GHG

  • Not able to read the WSDL on the server meets premature EOF

    Hi all

    I am facing problem while accessing a web server Service. Here is the clear view on this subject.

    I created a simple process of SyncBpel in a composite and deployed on the server and it works fine. Later, I created an asynchronous bpel process in a composite and in external reference I dragged a web Service and imported from the url of the wsdl for the SyncBpel server and wired the process of Asynbpel to webserive.
    Now here I am faced with a particular behavior that I'm not able to trace it.
    (1) for the first time when I import the url of the syncBpel from the server I am not faced with an error and it works well as expected, but when I close the Jdeveloper and open it I am not able to use the web Service, and it is said that "not being able to read the WSDL of the EOF Server premature encounter."
    (2) when I close and open the Jdeveloper, I can see the url for the WSDL imported into the Web server is changing http://stcfmw03.satyam.com:8021 / soa-infra/services/Tarak/synchronousBpel/bpelsync_client_ep? WSDL to http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel/BPELsync.wsdl
    (3) when I open and see the url http://stcfmw03.satyam.com:8021 / soa-infra/services/Tarak/synchronousBpel/bpelsync_client_ep? WSDL I can see the soap as address * < soap: address location = ":8021/soa-infra/services/Tarak/synchronousBpel!1.0*soa_5cfb8416-c106-40a2-a53b-9054bbe04b9c/bpelsync_client_ep"/ http://stcfmw03.satyam.com > * "

    I do not understand why the end of SOAP contains "* soa_5cfb8416-c106 - 40 has 2-a53b-9054bbe04b9c" and this kind of url for soap address happens to the bpel process which I am on the server deployment.

    I checked the in Jdeveloper where webproxy is uncheck and the server is also up, but still I am experiencing because of the mistake of reading.

    Can someone please help to resolve the issue.

    I am using SOA 11 g 11.1.1.5 and Jdeveloper 11.1.1.5


    Thank you very much.
    Tarak

    Published by: user11896572 on January 17, 2012 17:22

    Hello

    When a service is not deployed as a 'default' on soa-infra, we see characters such as-* soa_5cfb8416-c106 - 40a 2 - a53b - 9054bbe04b9c appended to the end.  It is better for the service references that will be deployed as default of all time.

    A service can be defined as a default value either during deployment, or by setting it manually on the em console.

    Thank you

  • not able to print the value of the url (aaa #bbb)

    Hello

    I am not able to print the < cfoutput > #url.xyz # < / cfoutput >

    Here, the url.xyz in the url value is aaa #bbb

    It is printing only aaa

    You should have url-encoded query from the beginning chain. Given that you don't have, Coldfusion ignored everything in the query string that comes after the character #. To fix this, replace the character # % 23. . In other words, .

    Another rule is that we should avoid the occurrence of the character # in a string. Thus, the correct value to cfoutput is "aaa ##bbb". To get and display code that is



    #url_xyz #.

  • I would use Yuanti SC police for my web development project. However, my developer is not able to use the file .ttc I extracted from the library of fonts, and .ttf, .otf .woff formats not available anywhere on the web.

    I would use Yuanti SC police for my web development project. However, my developer is not able to use the file .ttc I extracted from the library of fonts, and .ttf, .otf .woff formats not available anywhere on the web. Please, let me know how can I use this font for my project.

    Thank you

    Anton

    Unless the site you develop is for the Asian market, I don't know why you want to use that particular font. The Basic, standard and digital alphabet punctuation glyphs has sans serif, Roman characters, but the rest is thousands of Kanji characters. While you can use the font .ttf and .otf and web fonts, it would be very unusual to use one so great. Pages should load quickly and 78 MB, with a value of faces to download for those who have connections slow Internet is not fast.

    I would take a different font without serifs. There are literally thousands who look identical or virtually identical to Yuanti.

    131 free and high quality without font serif to choose here. I'm sure you can find a desired.

Maybe you are looking for

  • Gmail and IMAP

    My connection to gmail is for example "QWERTY".After creating account, I get the message: "password for [email protected]@imap.googlemail.com:What is "@[email protected]:"? Parameters:Server: imap.googlemail.comPort: 993user: qwerty@gmail.

  • Apple TV (4th gen) faster with 5 GHz WiFi with the ethernet cable

    When my Apple TV is connected to my network via 5 GHz WiFi it gives me a faster speed (about 120 Mbps) connections it makes when I plugged it on my network (about 45 Mbps) ethernet cable.  Why is this?  I thought that the ethernet would give me the f

  • Q150 input voltage? Help, please

    I sent twice, named Sales and no one yet knows the Q150 input voltage... Can someone view detailed list of specifications of Q150 which includes its input voltage? Or anyone who owns a Q150 can look for me? Thank you

  • Lack of drivers here 8440p

    Hello I just bought a second hand EliteBook 8440p. The previous owner had wiped and I installed windows 7 32 bit on it. There are 7 missing drivers. This is the name in the Device Manager and the hardware id. I can't find the drivers for these. BASE

  • How can I keep a window on top while I use other windows

    When I work with a few windows open I want to force one or more to stay at the top, is to always be visible.  Y at - it a command that will do? Thank you