Any Explanations y this query is not ordering ?

SELECT dept_id, salary, job_id
FROM employees
ORDER BY
( SELECT dept_id
FROM departments
WHERE last_name='Abel');
Assumptions:
1. The inner subquery gives a value of 10 only.
2. There is no 10th column in the Table Employees.
3. There is only 1 employee in the department 10.
Output it gives :
It gives all that is there in the employees table(projected cols), However the first record is always from dept_id= 10, then it just displays without ordering.

yes you are partially correct. The subquery will return only 10 and not 1 or 5 or any other value.
I have an explanation to this query bt I'm not sure about it.
Oracle checks for semantics and syntax at compile time. So if everything is correct then only it submits the query for execution. Now when a subquery executes only then oracle knows there is no 10th col in the database so it is a runtime error.

Similar Messages

  • Please show this query, data not showing why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO
    there is no any error and msg header and footer print.

    Maybe , the query in "NOT IN" clause select export_order1.orderno from export_order1
    return the same rows as the following portion return....
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    OR
    there are no rows which conform to the joining condition between the two tables BUYER and MERCH_ORDER ....
    Regards,
    Simon

  • Does apple have any explanations for why iCloud will not support iWeb & is there any viable solutions. iWeb is critical to my small business & we have all been trained via joint ventue on iWeb. Now it just goes away. Why?

    Does apple have any explanations for why iCloud will not support iWeb & is there any viable solutions. iWeb is critical to my small business & we have all been trained via joint ventue on iWeb. Now it just goes away. Why?

    turbodave2 wrote:
    I appreciate your repsonse, but the irony is that Apple is still scheduling "One-to-One" & Joint Venture training on iWeb knowing that it all will end next June. ..
    Just to add this : iWeb -- the app itself -- is still supported,updated only months ago and as part of the ilife '11 DVDs still widely spread even though it is not sold on the AppStore it is official part of iLife. It runs in Lion and there is zero issues with the app. So a training makes sense, doesn't it ?.
    They would only to exclude the "publish to me.com" part to be up to date for courses and trainings :-≠

  • Any idea what this query is trying to do?

    Do you guys have any idea what this query(used for report generation) is used for? I don't understand the WHERE clause of this query especially what the Pipe operators(|| ' 21:00:00') are used for?
    SELECT c.course_id,
           mph.subject
    from   courses c, main_pgm_hdr mph
    where
    c.classid=mph.classid
        AND
        TO_CHAR(MPH.CLOSE_DATE, 'mm/dd/yyyy hh24:mi:ss') >= TO_CHAR(TRUNC(SYSDATE, 'MM') - 1, 'mm/dd/yyyy')
            || ' 21:00:00'
        AND TO_CHAR(MPH.CLOSE_DATE, 'mm/dd/yyyy hh24:mi:ss') <= TO_CHAR(SYSDATE, 'mm/dd/yyyy')
            || ' 20:59:59'Edited by: user10450365 on Jan 13, 2009 7:11 PM

    They are trying to get the data having CLOSE_DATE between 20:59:59 and 21:00:00 for the present day. But the way its done is wrong. They have converted the date into Char and they are comparing. Its absolutely incorrect.
    One way to do it would be
    SELECT DISTINCT (PS.CARR_ID)                                  AS CARRIER  ,
         MPH.SHPMT_NBR                                          AS TRAILER  ,
         MPH.SHPMT_NBR                                          AS SHPMT_NBR,
         TO_CHAR(MPH.CREATE_DATE_TIME, 'mm/dd/yyyy hh24:mi:ss') AS LOADED   ,
         TO_CHAR(MPH.CLOSE_DATE, 'mm/dd/yyyy hh24:mi:ss')       AS FINALIZED
       FROM PARCL_SERV PS,
         MANIF_PARCL_HDR MPH
      WHERE PS.MANIF_TYPE = MPH.MANIF_TYPE
        AND MPH.CLOSE_DATE >= TRUNC(sysdate)+(21/24)
        AND MPH.CLOSE_DATE <= TRUNC(sysdate)+((20/24)+(59/1440)+(59/86400))Edited by: Karthick_Arp on Jan 13, 2009 1:27 AM

  • This query does not exist in the database in the system

    I have created a query, but when I run it, I receive this error:
    You have attempted to open query 0DAT from the Query Designer.
    However, this query does not exist in the database in the system to which you have made a connection.
    Thanks
    Joseilton

    dear Joseilton,
    the variable 0DAT ist not in active version in your system.
    Use BC to activate the variable 0DAT from InfoObject 0CALDAY.
    or
    you have to create it in your system. therefor change the namespye to SAP-namespace (starting with 0). Open one Query in your system via RRMX and select CalenderDay to create a new variable.
    name:                0DAT
    descrition:          current calender day
    processed by:        SAP EXIT
    Characteristic:      Calender Day
    variable represents: Single Value
    best regards
    imberaureus

  • AUDIO PROBLEMS when converting to youtube - When I export my file, parts of the audio are not working on ipads or iphones - any explanation for this?

    I am posting videos to youtube and for some reason different portions of my audio are not working both on iphone and ipads...  any thoughts on this would be appreciated

    Try using psd.  Some rerports indicate some confustion between the apps with TIFF.  See:
    https://discussions.apple.com/message/15921933#15921933
    I cannot confirm, nor test, since I use PS CS5, and not Elements.
    Ernie

  • I need a detailed explanation about this query!

    Hey Guys,
    I'm doing a course on distributed databases at uni. I have got this query but I am not 100% sure what is being executed first, the queries between brackets or outter ones.
    What is the difference between semi-join and join queries?
    what's meant by "WHERE EXISTS" clause?
    what's the union do with the results?
    SELECT C.COUNTRYNAME, C.CODE FROM "USER_HP_FULL"."COUNTRY" C
    WHERE EXISTS(
    SELECT 1 FROM (SELECT * FROM "USER1_HP_FULL"."ATHLETE1_REPLICA1"
    UNION SELECT * FROM "USER2_HP_FULL"."ATHLETE2_REPLICA1"
    UNION SELECT * FROM "USER3_HP_FULL"."ATHLETE3_REPLICA1") A
    WHERE A.CCODE = C.CODE)
    ORDER BY C.COUNTRYNAME;
    Thank you!

    >
    I'm doing a course on distributed databases at uni. I have got this query but I am not 100% sure what is being executed first, the queries between brackets or outter ones.
    >
    Then you should
    1. open a sql*plus command window
    2. log on as a user with the correct privileges
    3. set serveroutput on
    4. set autotrace traceonly
    5. execute the query
    Examine the execution plan - it will show you what is being executed first. If you have questions post the plan using \ tags.
    {quote}
    What is the difference between semi-join and join queries?
    {quote}
    The documentation is your friend.
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/queries006.htm
    {quote}
    what's meant by "WHERE EXISTS" clause?
    {quote}
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/conditions012.htm#sthref2960
    {quote}
    EXISTS Condition An EXISTS condition tests for existence of rows in a subquery.
    {quote}
    {quote}
    what's the union do with the results?
    {quote}
    Eliminates duplicates in multiple query results
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/queries004.htm
    See 'The UNION [ALL], INTERSECT, MINUS Operators' in the SQL Language doc
    {quote}
    UNION Example The following statement combines the results of two queries with the UNION operator, which eliminates duplicate selected rows.
    {quote}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Why this query does not show the result?

    Why the query with the schema prefixed does not show the result and the query without schema display the correct results?
    SQL> select data_object_id,object_type from dba_objects where object_name='HR'.'JOBS';
    select data_object_id,object_type from dba_objects where object_name='HR'.'JOBS'
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    SQL> select data_object_id,object_type from dba_objects where object_name='HR.JOBS';
    no rows selected
    SQL> select data_object_id, OWNER, object_type from dba_objects where object_name='JOBS';
    DATA_OBJECT_ID     OWNER                          OBJECT_TYPE
    69662              HR                                 TABLE
                       OE                                 SYNONYM
    SQL> SELECT USER FROM DUAL;
    USER
    SYS

    Hi,
    the column object_name refers to a object_name which is 'JOBS', the column owner refers to the owner 'HR', the value isn't stored together, so you have to select the two columns. It is the same behaviour as every other table/view. Have a look at the values in the view DBA_OBJECTS.
    Herald ten Dam
    Superconsult.nl

  • HT201320 Hi - Question that i am hoping others after reading this query do not have

    Hi - used to work for a company that unfortunately I have my apple email with - throught that I have cha nged the old email to ( and i know i had associated the old itunes account with the new - hiowever I cannot get o the emial server for my old work to retrieve and then chage the passord - i also cnnot see THE HYUNDERS OF HOURS of muic i had assoicated wiht that account and lost a lot of contactrs in the process
    to make matters worse - the same company then attended to a phone and sim swap which has created havic in my life - thoughts or solutions pls
    matt

    Hi,
    Regarding 2:
    http://obiee101.blogspot.com/search/label/HTTP%28S%29
    Regarding 4:
    This can be set in the instanceconfig.xml (see administrator guide)
    regards
    John
    http://obiee101.blogspot.com

  • Please see this query, not showing data Why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO

    Where "first table" is merch_order and "second table" is export_order1?
    How many distinct orders are in each table?
    Are there any NULL order numbers in either table?
    I'd put money on the fact that if commenting out a clause causes a number of rows to be returned, that clause is filtering out all the rows. You'll need to go through your data to figure out why the NOT IN clause is filtering out all your rows.
    Justin

  • Why between for date is not returning data for this query ?

    Hello,
    i have a table with this structure and i am writing this query for fetching some rows based on some condition , but this query is not returning any data . Can you please tell why ?
    ID     DT
    003     11/8/2011
    002     10/8/2011
    001     9/8/2011
    And the query is :
    SELECT * FROM TABLE_NAME WHERE DT BETWEEN TO_DATE('08/08/2011','dd/mm/yyyy') AND TO_DATE('12/08/2011','dd/mm/yyyy');
    Edited by: bootstrap on Aug 13, 2011 7:10 AM

    >
    >
    but what is the problem with that, why that date is not matched when i am providing the date format ?Which part don't you understand? You did not use TO_DATE while inserting data and default date format was mm/dd/yyyy, right? Same default date format is used if you issue:
    SELECT * FROM TABLE_NAME Your original post states the above select returns:
    ID     DT
    003     11/8/2011
    002     10/8/2011
    001     9/8/2011So dates you inserted are November 8, 2011, October 8 2011 and September 8 2011. Now TO_DATE('08/08/2011','dd/mm/yyyy') is August 8 2011 and TO_DATE('12/08/2011','dd/mm/yyyy') is August 12 2011. So obviously:
    SELECT * FROM TABLE_NAME WHERE DT BETWEEN TO_DATE('08/08/2011','dd/mm/yyyy') AND TO_DATE('12/08/2011','dd/mm/yyyy');will not return any rows. Bottome line - never write code that uses implicit date conversions since your code becomes client NLS settings dependent and might work for one client and fail or produce wrong results for other client.
    SY.

  • After BI Stats installation: Why is this query not reporting on my query?

    Hi,
    ok, so I thought I was done with BI Stats installation and I run a query:
    Detailed Query Runtime Statistics: Analysis 0TCT_MC02_Q0200 0TCT_MC02
    which came with the installation.
    I see query QueryColleague in this query with the information:
    Time       = 21.992
    Time:Ste =29.480
    Counter  = 0
    1.
    What is the significance of these 3 figures (Time, Time:Ste, Counter)? Does it in any way give a sense of the performance of the query?
    2.
    Under the “Settings for BI Statistics” I verified and QueryColleague was set as:
    Statistics = D
    OLAP detail level = (blank)
    I have a query QueryMyOwn which following the installation guidelines, I set up as:
    Statistics = X
    OLAP detail level = 2
    I have since run QueryMyOwn a and run the delta process chains again but this query still not does appear in this “Detailed Query Runtime Statistics”. Any idea what may be going on?
    3.
    Am I misinterpreting this report? I thought it was going to show a list of queries which BS Stats has collected data and reporting on them.
    4.
    Which of the many queries which come with the BI Stats have you found useful so far? I will appreciate the reason. Any particular one standing out if you need to track why a particular report may not be performing well?
    Thanks

    Hi,
      I think you are viewing the queries from Admin cockpit 0TCT_MC02_Q0200 which has filter to display the query that had been executed  in last 24 hours.
    Most of the queries from Admin Cockpit will be help you to monitor the data load stats, which load taken long time to complete including the process chains, DTP etc. There are some other queries with have conditional / Expection which filter the data based on top 10 process etc.
    Few Queries that was useful to me are
    0TCT_MC22_Q0104 - Long term trends in total runtime
    0TCT_MC12_Q0110 - Process status
    0TCT_MC01_Q0122 - Deviation in runtime of BI Application Object
    Hope it helps,
    Cheers,
    Balaji

  • Did not order this app!

    Woke up this morning to find "Koroku Album" a dog photo application installed on my iPad. I never ordered this application, would not order it and...deleted it. However, upon research, I find it was a $4.99 app and am wondering if my account was charged. After reading about the recent iTunes hacking, I am thinking this is another one...any thoughts?

    iTune cards are the only way to go. I use them to control and monitor how much I spend. I usually keep at least $10 so I can purchase a song or two, then if I need more I just add another card. I buy them in packs of 3 for $10 each, a $30 pack. Now, I'm wondering how do I get $100 card for $93.
    Since reading all of this, I've removed my cc and now I will only use iTune cards. I wish someone would tell me, what has happened to Apple. They don't want to admit, take responsibility or correct their issues. Have they forgotten their dark day? The fall is not to great that it can't be made. Be authentic! Fix the issues and stop taking us for granted. When someone's cc info has be stolen and used to make a purchase, once reported, the money should be REFUNDED IMMEDIATELY! I remember getting a refund for an app I purchased by mistake! This is BS.
    I want the old Apple back! The one that made promises and DELIVERED! This fake Apple has GO TO GO!!!
    *Very upset and fast losing FAITH in the Apple Brand.*
    *SG*

  • Is there anything that can be done to tune this query?

    DB version:10gR2
    From AWR report, we have determined that the following SQL is taking most CPU Time. Is there anything that we can do to improve the performance of this query.
    We have an index on (stat_code,create_date_time) columns of ext_replenish table.
    SELECT EXT_REPLENISH.EXT_REPLENISH_ID, EXT_REPLENISH.EVENT_ID, EXT_REPLENISH.EVENT_KEY, EXT_REPLENISH.WHSE, EXT_REPLENISH.VALIDATE_KEY, EXT_REPLENISH.NBR_OF_RETRY, EXT_REPLENISH.STAT_CODE, EXT_REPLENISH.ERROR_SEQ_NBR, EXT_REPLENISH.CREATE_DATE_TIME, EXT_REPLENISH.MOD_DATE_TIME, EXT_REPLENISH.USER_ID, EXT_REPLENISH.CL_MESSAGE_ID, EXT_REPLENISH.SCHEMA_ID, EXT_REPLENISH.ELS_ACTVTY_CODE, EXT_REPLENISH.CD_MASTER_ID FROM EXT_REPLENISH WHERE ( ( ( ( ( EXT_REPLENISH.STAT_CODE = :1 ) OR ( EXT_REPLENISH.STAT_CODE = :2 ) ) OR ( ( ( EXT_REPLENISH.STAT_CODE = :3 ) AND ( EXT_REPLENISH.ERROR_SEQ_NBR >= :4 ) ) AND ( EXT_REPLENISH.ERROR_SEQ_NBR < :5 ) ) ) AND ( EXT_REPLENISH.MOD_DATE_TIME <= :6 ) ) AND ( EXT_REPLENISH.NBR_OF_RETRY < :7 ) ) AND ROWNUM <= 1 ORDER BY EXT_REPLENISH.STAT_CODE ASC, EXT_REPLENISH.CREATE_DATE_TIME ASC FOR UPDATE
    Is there anyway i could tune this query?
    note: Ignore the unnecessary brackets. They are system created(apparently by hibernate)
    Message was edited by:
    Nichols
    Taking off the pre tags due to readability issue(all words appear in single line )
    Message was edited by:
    Nichols

    From just blindly looking at this particular query, there doesn't seem any obvious reason why an index couldn't be extended to cover all the columns specified in the where clause.
    It might not help too much -> explain plan is required first really before blindly guessing.
    Obviously, there's no point having an order by and a rownum (unless you wanted to do the order by before the rownum in an outer select) - I assume this is just a Hibernatism.

  • After clicking on my FF shortcut icon on my desktop, it takes FF 30-45 seconds to open. Any ideas why this happens?

    after clicking on my FF shortcut icon on my desktop, it takes FF 30-45 seconds to open. So i sit there and wai and wait and wait until it finally opens. Any ideas why this happens?

    In order to diagnose your problem you will need to download and install the below
    Try clicking the tap problematic apps while the trace is running
    Install the WPT (windows Performance Toolkit) 
    http://www.microsoft.com/en-us/download/details.aspx?id=30652
    Help with installation (if needed) is here
    When you have, open an elevated command prompt and type the following 
    WPRUI.exe (which is the windows performance recorder) and check off the boxes for the following:
    First level triage, CPU usage, Disk IO.  
    If your problem is not CPU or HD then check off the relevant box/s as well (for example networking or registry)  Please configure yours as per the below snip
    Click Start
    Let it run for 60 secs or more and save the file (it will show you where it is being saved and what the file is called)
    Zip the file and upload to us on Onedrive (or any file sharing service) and give us a link to it in your next post.
    Wanikiya and Dyami--Team Zigzag

Maybe you are looking for

  • Lenovo M92P 2992E5U Monitor problem

    Just recently bought a Lenovo M92P 2992EU from amazon. http://www.amazon.com/Lenovo-2992E5U-M92p-Desktop/dp/B00A2V3SV0/ref=sr_1_4?ie=UTF8&qid=1375841434&sr... When i plug my monitor to the motherboard VGA port, there's no display on the monitor.  How

  • Change a Labels Style

    I was wondering if anyone can help me out. I am trying to change a style of a label dynamically. The problem is I get an error "Call Attempted on an object that is not a function" if I try to define the var as an object and it doesn't work correctly

  • Bug in Premiere Pro CC Multicam?

    So, I'm getting a bad issue in one of my multicam sections. I'm running Creative Cloud applications on Mac OS X Mountain Lion. I have 5 or 6 seperate multicam sequences and the issue occurs on only one of them, which makes me think this must be a gli

  • Problem to simulate vivado IPs , with Modelsim

    Hi I am running Vivado 2015.2 I already compiled the simulation libraries for modelsim using the IP catalog I generated IP of  FFT core. The simulation  file contains the line: LIBRARY xfft_v9_0; When tring to compile the FFT output sim file I got an

  • Unable to open a new tab by +

    Since several weeks i have a problem with Fire Fox. It's not possible to open a new tab with + . I saw that ther's another person having the same problem, but i couldn't read the solution. Is there a solution yet, at my desktop i don't have this prob