Slow Query only with some values??????

I have this tables:
Vehicles: id_vehicle, id_customer, registration_number, model, ... (2.000.000 of records) (1.500.000 distinct id_customer)
Insurance-Customers-Vehicles: id_insurance, id_customer, id_vehicle ... (4.500.000 of records)
Insurance: id_insurance, date_insurance, ...
Customers: id_customer, name, surname, ..
QUERY:
select
vh.id_vehicle,
vh.id_customer,
vd.model,
vd.registration_number
from Insurance-Customers-Vehicles vh
left join Vehicles v on (vh.id_vehicle = v.id_vehicle and vh.id_customer = v.id_customer)
inner join Vehicles vd on (vh.cod_vehiculo = vd.cod_vehiculo)
where vh.id_customer = 123456
and vh.id_vehicle is null
I execute this query because I want to obtain Vehicles that have been associated with a customer but I don’t want to obtain the vehicle-customer on Insurance-Customers-Vehicles table if it’s now associated to the vehicle-customer on vehicles table.
This query is very fast at 99% of the time (less than 1 second), but when a client has many vehicles associated (more than 50) on Insurance-Customers-Vehicles table the query is very slow and takes between 10 and 20 seconds ...
Insurance-Customers-Vehicles
Please, How can I improve it?????
Thanks in advance!!!!!
Operation     Object Name                              Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
SELECT STATEMENT Optimizer Mode=CHOOSE                         3             12                                          
  NESTED LOOPS                                        3       498       12                                          
    FILTER                                                                
      NESTED LOOPS OUTER                                                                
        TABLE ACCESS BY INDEX ROWID     Insurance-Customers-Vehicles     3       408       6                                          
          INDEX RANGE SCAN     IND_INSCUVEH_ID_CUSTOMER          3             3                                          
        TABLE ACCESS BY INDEX ROWID     VEHICLES               1       13       2                                          
          INDEX UNIQUE SCAN     PK_VEHICLES                    1             1                                          
    TABLE ACCESS BY INDEX ROWID     VEHICLES                    1       17                                                
      INDEX UNIQUE SCAN     PK_VEHICLES                         1             1                  

I think there is something logically wrong with this query.
You left join the vehicle table, however you already know that id_vehicle is NULL.
I'm not sure what it should achieve, maybe you should replace this join with an EXISTS sub select, maybe you can remove this join completely.
Try to find an example where your query gives a different result than this one. And explain me why the result is different.
select vh.id_vehicle,
      vh.id_customer,
      vd.model,
      vd.registration_number
from Insurance-Customers-Vehicles vh
inner join Vehicles vd on (vh.cod_vehiculo = vd.cod_vehiculo)
where vh.id_customer = 123456
and vh.id_vehicle is null;Message was edited by:
Sven W.

Similar Messages

  • Query data with some value & display in datatable at page

    hi,
    I have bean and when user enter some page i use datatable to display some data from oracle:
    <h:dataTable id="dt1" value="#{GetDataOracle.rep_tcok_pl2_connects}" var="item" bgcolor="#F1F1F1" border="10" cellpadding="5" cellspacing="3" width="70%" dir="LTR" frame="hsides" rules="all" summary="This is a JSF code to create dataTable." >i want to first user defined start date and end date of report, type it into the form and later click submit and display report.
    I know how to do that not using framework, please tell me how to do that in JSF?
    I have main Controller servlet and my Bean is sth like this:
    package logic;
    import java.util.ArrayList;
    import java.util.List;
    import javax.naming.*;
    import java.sql.*;
    import exception.NoConnectionException;
    * @author pawel
    public class GetDataOracle {
    Connection con = null;
    Statement ps = null;
    ResultSet rs = null;
    private List perInfoAll = new ArrayList();
    private List rep_dws_wnioski_wstrzymane_cnt = new ArrayList();
    private List rep_dws_wnioski_wstrzymane_graph = new ArrayList();
    private List rep_tcok_ppi_connects = new ArrayList();
    private List rep_tcok_pl_connects = new ArrayList();
    private List rep_windyk_hip_umowa_to_call = new ArrayList();
    private List rep_tcok_pl2_touchpoint_count = new ArrayList();
    private List rep_tcok_pl2_connects = new ArrayList();
    public List getperInfoAll() {
        int i = 0;
        try {
        con = Database.createConnection();
        ps =    (Statement) con.createStatement();
        rs = ps.executeQuery("select sso, fname, sname, lev, last_login, login_count from stg123054130.oraclereports_user order by sname");
        while(rs.next()){
          perInfoAll.add(i,new getUsersData(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getString(6)));
          i++;
        } catch (NamingException e) {
            e.printStackTrace();
            throw new NoConnectionException(); 
        } catch (SQLException e) {
            e.printStackTrace();
            throw new NoConnectionException(); 
        } catch (NullPointerException e) {
            e.printStackTrace();
            throw new NoConnectionException();  // obsluga bledy na wypadek jesli braknie wolnych polaczen do bazy
        } finally {
        try {
            if(con != null)
            con.close();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
            throw new NoConnectionException();  // obsluga bledy na wypadek jesli braknie wolnych polaczen do bazy
    return perInfoAll;
    public class getUsersData {
    String sso;
    String fname;
    String sname;
    String lev;
    String last_login;
    String login_count;
    public getUsersData(String sso, String fname, String sname, String lev, String last_login, String login_count) {
        this.sso = sso;
        this.fname = fname;
        this.sname = sname;
        this.lev = lev;
        this.last_login = last_login;
        this.login_count = login_count;
    public String getsso() {
        return sso;
    public String getfname() {
        return fname;
    public String getsname() {
        return sname;
    public String getlev() {
        return lev;
    public String getlast_login() {
        return last_login;
    public String getlogin_count() {
        return login_count;
    }How should i send to my Bean info that i want data where:
    select sso, fname, sname, lev, last_login, login_count from stg123054130.oraclereports_user
    where last_login > to_date('20091101','YYYYMMDD')
    order by sname;
    ?

    Hi 404116,
    Here's another method :
    1. After you have queried the Block-3 <Subject Block> you have the Student-id from Block-2 which you can use to query the Block-1.
    -- I will use the following code to query the Block-1
    1. Check the Block Status of Block-1. As you have queried the Block-3 and Not Block-1, the Block Status of Block-1 should not be 'QUERY'.
    2. If status of Block-1 is not 'QUERY' And
    status of Block-2 is 'QUERY'
    Then
    /* The query process is reverse from Block-3 first */
    2a. Use the Set_Block_Property Built-In to define the Where Condition for the Block-1.
    Where column to Query = : Block-2.Student Id
    2b. Remove the Relation between Block1 and Block-2 at Run Time.
    2c. Go_Block ('Block-1');
    Clear_Block (No_Validate);
    Execute_Query;
    And Remember,
    1. To remove the Where Condition set in Block-1 when you query from Block-1 first
    2. And re-define the MD relation from Block-1 to Block-2
    -- Shailender Mehta --

  • A filter value for Query is set with some value automatically

    Hello SAP sourcing Guru!
    I created a query which has several filters.
    Some of Filter's type is VLV.
    When I preview the query somehow the filter values are already set with some value even though I did not set the default value.
    For example, filter name is Region and there are four regions: Asia, NA, Europe, and SA.
    I want to select one of them from drop-down menu. But Asia was already selected when I clicked the preview button for the query. I want to see "Please Select" instead of Asia from drop-down menu. I did not select "Prefill value from cache" for the filter. I made the filter Optional only. I did not set Default Value either for the filter.
    Any clues?
    Thank you for your response in advance.

    Hi,
    In the Default value field of the filter prompts, you need to mention the Class Reference ID of the corresponding field. E.g., if you have Contract document phase as a filter, then in that if you want to display a blank or none value, then you should use null:2016.
    Similarly for vlv type, the system has a value 616. Hence if you want to display a None value insteead of Asia, use the following in the Default value field:
    0:616:null.
    The way to find the class reference ID is to goto the RG > Class Reference > Look for the field that you are attempting to default on.
    Hope this helps,
    Vikram

  • Query only non numeric values in a column

    How to query only non numeric values in a cloumn.
    For example:
    Table1 has a column1(col1)
    Values:
    Row Value
    1 27376
    2 47D99
    3 83039
    4 DKFI*
    5 3J6
    Query should retrieve only rows(2,4,5).
    Thanks! for help
    Murali

    Version 2(PL/SQL) above is not clear enough, It can be tuned to the following:
    -- Create a function
    Create or replace function IsVARCHAR(pCol VARCHAR2) return VARCHAR2
    AS
    vNumber NUMBER := 0;
    begin
      vNumber := to_number(pCol);
      RETURN NULL;
    Exception
      When Others Then
        RETURN pCol;
    End;
    -- To See VARCHAR values (alpha-numeric) only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NOT NULL;
    -- To See NUMBER values only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NULL;Versatility here with PL/SQL, but I personally like SQL versions.
    Thx,
    SriDHAR

  • Blurd,transparent messagebox with some values to be selected

    I have seen many times that if we give any command on web page then a blurd and transparent type messagebox comes on screen with some values in it and screen .
    When we select any value on that messagebox that values goes on next page.
    I dont know how to proceed for such transparent window.
    anybody please help.
    thanks and regards

    Are you sure this has something to do with Java?
    (Javascript.is.not.Java)
    db

  • When I try to work with some photos Imovie gets stuck and then it stops to work at all. It happens only with some specific photos,is there a way to repair them?I can't go on this way,help me please

    When I try to work with some photos Imovie gets stuck and then it stops to work at all. It happens only with some specific photos,is there a way to repair them?I can't go on this way,help me please

    Hi,
    The movie is probably MPEG format.
    QuickTime Pro and iMovie cannot transcode audio contained in MPEG movies.
    Try to convert with SimpleMovieX or MPEG Streamclip instead.
    http://www.aeroquartet.com/SimpleMovieX/
    http://www.squared5.com
    Regards, BJ

  • Some Maisl recieved diappear after clicking on email. ONLY with some emails

    Some Mails recieved disappear after clicking theml. This happens ONLY with some emails, inconsistant. Anyone experienced this als well? Solution available? Txs

    HI,
    We had a similar problem while creating a NCR.You can give this one a shot. Just see whats the "Tax Code' for the supplier that you have entered while creating the NCR.Try changing the tax code for that particular supplier and see if it is working fine.
    Subbu

  • When we execute   transcation selection-screen should come with some values

    hi gurus,
    My requirement is whenever user executes a particular transaction,
    selection screen should appear with some values by default.
    can you suggest me in solving this problem.
    its urgent.
    thanks,
    Bhanu.R

    Hi,
    for that do like:
    A transaction with a variant can have its own transaction code, which you can then use to execute the transaction with the appropriate variant.
    To create a variant transaction, proceed as follows:
    Choose Goto ® Create vari. trans. from the initial transaction variant maintenance screen.
    Enter a transaction name and corresponding short text. Transaction type Variant transaction is already set. The following screen already contains default values for the name of the calling transaction, the variant name, and the client-specific or cross-client variant checkbox.
    Save your entries.
    Example:
    Variant ABC has been defined for transaction Z000. We now want to create the variant transaction ZVAR.
    Name of the new transaction: ZVAR
    Name of the calling transaction: Z000
    Name of the variant: ABC
    Transaction ZVAR starts transaction Z000 with variant ABC.
    If the variant specified for a variant transaction does not exist (in the current client), then the calling transaction will be started without variant.
    Regards,
    Renjith Michael.

  • Parameterized queries running much slower than ones with hardcoded values

    Very often there is a huge performance difference when using parameters in a query, compared to running the same code after replacing the parameters with hardcoded values: the parameterized version of the code runs much slower!
    The case is not parameter sniffing as it is not a (compiled) stored proc, but code executed directly from the editor and the performance issue has been observed in different versions of SQL Server (2000 and 2005).
    How is this explained and how can the parameterized queries have similar performance with the hardcoded ones?
    Also, why does this happen in some cases and not always?
    Finally, the same is sometimes the case with stored procs: a very slow running proc speeds up tremendously when running its code directly, instead of calling the procedure --and even faster, according to the previous, when its parameters are replaced with
    hardcoded values 

    >>The case is not parameter sniffing as it is not a (compiled) stored proc, but code executed >>>directly
    from the editor ?>>>and the performance issue has been observed in different >>>versions of SQL Server (2000 and 2005).
    Something like below?
    --SQL Server creates 3 execution plan rather only one
    DBCC FREEPROCCACHE
    GO
    SELECT *
    FROM Sales.SalesOrderHeader
    WHERE SalesOrderID = 56000
    GO
    SELECT * FROM
    AdventureWorks.Sales.SalesOrderHeader WHERE
    SalesOrderID = 56001
    GO
    declare @i int
    set @i = 56004
    SELECT *
    FROM Sales.SalesOrderHeader
    WHERE SalesOrderID = @i
    GO
    select  stats.execution_count AS exec_count, 
    p.size_in_bytes as [size], 
    [sql].[text] as [plan_text]
    from sys.dm_exec_cached_plans p
    outer apply sys.dm_exec_sql_text (p.plan_handle) sql
    join sys.dm_exec_query_stats stats ON stats.plan_handle = p.plan_handle
    GO
    ----This time only (we get parameterization)
    DBCC FREEPROCCACHE
    GO
    EXEC sp_executesql N'SELECT  SUM(LineTotal) AS LineTotal
    FROM Sales.SalesOrderHeader H
    JOIN Sales.SalesOrderDetail D ON D.SalesOrderID = H.SalesOrderID
    WHERE H.SalesOrderID = @SalesOrderID', N'@SalesOrderID INT', 56000
    GO
    EXEC sp_executesql N'SELECT  SUM(LineTotal) AS LineTotal
    FROM Sales.SalesOrderHeader H
    JOIN Sales.SalesOrderDetail D ON D.SalesOrderID = H.SalesOrderID
    WHERE H.SalesOrderID = @SalesOrderID', N'@SalesOrderID INT', 56005
    GO
    select  stats.execution_count AS exec_count, 
    LEFT([sql].[text], 80) as [plan_text]
    from sys.dm_exec_cached_plans p
    outer apply sys.dm_exec_sql_text (p.plan_handle) sql
    join sys.dm_exec_query_stats stats ON stats.plan_handle = p.plan_handle
    GO
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Calling html from java with some values

    Hello friends,
    I can call a HTML file from java.I want to pass some values from java class file to that html file.Anybody help me how to pass parameters?
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://localhost:8080/jcoDemo/dp.html");
    is one i am using for calling html file
    thanks

    Just add GET query parameters to the URL.
    Besides, if you were using Java 1.6 or newer, then rather use [Desktop#browse()|http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)] instead of Runtime#exec(). It is crossplatform while your runtime approach works in Mircosoft Windows systems only.

  • Submit a report program with same selection screen with some values exclude

    Dear All,
    I have to  submit a stndard report program from a copied zprogram with same slection screen values ,
    and in some slect-options some values will be excluded depending upon the zprogram.
    How to make it.
    I mean when i submit , same selction screen values should go along with , depending upon some condions i have to exclude some values .
    for ex: selection screen from a to b
    posting date should go same
    but may be along with it i have to pass movem,ent type <> 202 to the submit screen ,.
    how to do this?

    Hi Rajendra
    >What if i have to pass the movement type also 200 to 250 , with 202 and 203 exluded .
    Use BT ( between ) operator for 200 to 250 :
    lr_move_type-sign = 'I'.
    lr_move_type-option = 'BT'.
    lr_move_type-low = '200'.
    lr_move_type-high = '250'.
    COLLECT lr_move_type.
    And use NE ( not equal )  operator to exclude 202 and 203 :
    lr_move_type-sign = 'I'.
    lr_move_type-option = 'NE'.
    lr_move_type-low = '202'.
    COLLECT lr_move_type.
    lr_move_type-low = '203'.
    COLLECT lr_move_type.
    It works just this way.
    > Secondly,
    >
    > If i have the selction sreen same in both the screen , is it possible to pass the same values as it is with out writing one by one selct-option and parameter?
    No I don't think there is way to do it without writing one by one
    but you may not specify for empty select-options.
    Edited by: Bulent Balci on Aug 21, 2010 11:46 AM

  • IMessage works only with some contacts

    Why is iMessage working (blue) with some contacts and not with others? Obviously all with iPhones and iMessage activated

    Hi there Bretsinclair,
    You may find the troubleshooting steps in the article below helpful.
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    -Griff W. 

  • Need to hide rows in the Query results with blank values

    Hi All,
    We have a requirement like this for Stock Report, we need to display both movements and balance in that report. We display the movement data directly from the Standard cube with input as Fiscal period/year.  When we do like this, we are not able to get the opening balance as fiscal period was in char restrictions pane.
    We have created a dummy keyfigure restricted to Fiscal period ( so that the global filter is not applied and get the inventory data irrespective of fiscal period input ). We have created 3 variables of processing type customer exit and acheived calculating opening balance, current movement and closing balance.
    If FP input is 009.2010 to 010.2010, it will get whatever Qty moved before 009.2010 ( 001.1990 - 009.2010 in exit ) as opening balance and closing balance ( 001.1990 - 010.2010 )  and the Qty KF restricted with another exit varibale ( 009.2010 to 010.2010 ).
    Hope everyone understood the scenario and issue here is, though I give the input 009.2010 - 010.2010 , I get the rows displayed for different periods ( this is because I am retreiving data for all the fiscal periods but restricting it based on input ). How to restrict/hide these rows.
    Your inputs and suggestions are valued.
    Thanks,
    Chandra.

    Hi,
    Try creating a query level field which would populate as "X" (with the IF condition ) if the record falls in the period which you have given for input variable (009.2010 - 010.2010). Then place a query level filter for this field where only records with value "1" for this field is displayed.
    Hope this helps.
    Happy to help further.
    Regards
    Venky

  • Slow query times with "contains" and "or"

    We're running Oracle 9.2.0.4 on RHEL 3
    I have a simple table - "docinfo". I've create a multicolumn Text index for docinfo called "repoidx". I have five cases below with the fourth one being the most difficult to understand. I have a primary key for "docinfo" but do nott have any additional indexes on "docinfo" right now because we're still testing the design. I'm curious about what is magical about using "or" plus "contains" in the same query (case 4).
    [case 1 - simple like]
    select count(docid)
    from sa.docinfo
    where
    author like '%smith%'
    Elapsed: 00:00:00.02
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1468 Card=1 Bytes=15)
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (FULL) OF 'DOCINFO' (Cost=1468 Card=12004 Bytes=180060)
    [case 2 - simple contains]
    select count(docid)
    from sa.docinfo
    where contains(repoidx,'facts')>0
    Elapsed: 00:00:01.00
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3905 Card=1 Bytes=12)
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'DOCINFO' (Cost=3905 Card=21278 Bytes=255336)
    3 2 DOMAIN INDEX OF 'IDX_DOCINFO_REPOIDX' (Cost=3549)
    [case 3 - simple like _and_ simple contains]
    select count(docid)
    from sa.docinfo
    where
    contains(repoidx,'facts')>0
    and
    author like '%smith%'
    Elapsed: 00:00:00.02
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3905 Card=1 Bytes= 23)
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'DOCINFO' (Cost=3905 Card=1064 Bytes=24472)
    3 2 DOMAIN INDEX OF 'IDX_DOCINFO_REPOIDX' (Cost=3549)
    [case 4 - simple like _or_ simple contains]
    select count(docid)
    from sa.docinfo
    where
    contains(repoidx,'facts')>0
    or
    author like '%smith%'
    Elapsed: 00:01:37.02
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1468 Card=1 Bytes= 23)
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (FULL) OF 'DOCINFO' (Cost=1468 Card=32218 Bytes=741014)
    [case 5 - simple like union simple contains]
    select count(docid)
    from sa.docinfo
    where
    contains(repoidx,'facts')>0
    union
    select count(docid)
    from sa.docinfo
    where
    author like '%smith%'
    Elapsed: 00:00:00.04
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5581 Card=2 Bytes= 27)
    1 0 SORT (UNIQUE) (Cost=5581 Card=2 Bytes=27)
    2 1 UNION-ALL
    3 2 SORT (AGGREGATE) (Cost=4021 Card=1 Bytes=12)
    4 3 TABLE ACCESS (BY INDEX ROWID) OF 'DOCINFO' (Cost=3905 Card=21278 Bytes=255336)
    5 4 DOMAIN INDEX OF 'IDX_DOCINFO_REPOIDX' (Cost=3549)
    6 2 SORT (AGGREGATE) (Cost=1560 Card=1 Bytes=15)
    7 6 TABLE ACCESS (FULL) OF 'DOCINFO' (Cost=1468 Card=12004 Bytes=180060)

    Case 1:
    There is no index on author and it would not be able to use one if there was, due to the leading %, so it does a full table scan, which is still quick, since that is all there is to the query.
    Case 2:
    It has an index on repoidx, so it uses it and it is quick.
    Case 3:
    It has an index on repoidx, so it uses it. Since "and" is used, both conditions must be met. It has quckly obtained the results that match the first condition using the index, so it only has to check those rows, not every row in the table, to see if they also match the second condition.
    Case 4:
    Either condition may be met. It does not have an index on author, so it cannot use an index for that conditiion. Either condition can be met and it cannot duplicate the rows where both conditions are met, so it cannot use the results of one condition to check the other. So, it has to do a full table scan, in order to check every row for either condition, so it is slow.
    Case 5:
    select count (docid)
    from   docinfo
    where  contains (repoidx, 'facts') > 0
    union
    select count (docid)
    from   docinfo
    where  author like '%smith%';is not the same as:
    select count (docid)
    from   (select docid
            from   docinfo
            where  contains (repoidx, 'facts') > 0
            union
            select docid
            from   docinfo
            where  author like '%smith%');which is the same as case 4 and therefore just as slow. Your case 5 is just taking the union of 2 numbers, which could result in one row or two rows, depending on whether the numbers happen to match or not. Consider the following:
    scott@ORA92> SELECT job, empno
      2  FROM   emp
      3  /
    JOB            EMPNO
    CLERK           7369
    SALESMAN        7499
    SALESMAN        7521
    MANAGER         7566
    SALESMAN        7654
    MANAGER         7698
    MANAGER         7782
    ANALYST         7788
    PRESIDENT       7839
    SALESMAN        7844
    CLERK           7876
    CLERK           7900
    ANALYST         7902
    CLERK           7934
    14 rows selected.
    scott@ORA92> SELECT job, COUNT (empno)
      2  FROM   emp
      3  GROUP  BY job
      4  /
    JOB       COUNT(EMPNO)
    ANALYST              2
    CLERK                4
    MANAGER              3
    PRESIDENT            1
    SALESMAN             4
    scott@ORA92> SELECT COUNT (empno)
      2  FROM   emp
      3  WHERE  job = 'SALESMAN'
      4  /
    COUNT(EMPNO)
               4
    scott@ORA92> SELECT COUNT (empno)
      2  FROM   emp
      3  WHERE  job = 'CLERK'
      4  /
    COUNT(EMPNO)
               4
    scott@ORA92> SELECT COUNT (empno)
      2  FROM   emp
      3  WHERE  job = 'SALESMAN'
      4  UNION
      5  SELECT COUNT (empno)
      6  FROM   emp
      7  WHERE  job = 'CLERK'
      8  /
    COUNT(EMPNO)
               4
    scott@ORA92> -- the above is the same as:
    scott@ORA92> SELECT 4 FROM DUAL
      2  UNION
      3  SELECT 4 FROM DUAL
      4  /
             4
             4
    scott@ORA92> -- it is not the same as:
    scott@ORA92> SELECT COUNT (empno)
      2  FROM   (SELECT empno
      3            FROM   emp
      4            WHERE  job = 'SALESMAN'
      5            UNION
      6            SELECT empno
      7            FROM   emp
      8            WHERE  job = 'CLERK')
      9  /
    COUNT(EMPNO)
               8
    scott@ORA92> -- if the numbers are different, you get 2 rows:
    scott@ORA92> SELECT COUNT (empno)
      2  FROM   emp
      3  WHERE  job = 'ANALYST'
      4  UNION
      5  SELECT COUNT (empno)
      6  FROM   emp
      7  WHERE  job = 'MANAGER'
      8  /
    COUNT(EMPNO)
               2
               3
    scott@ORA92> -- the above is the same as:
    scott@ORA92> SELECT 2 FROM DUAL
      2  UNION
      3  SELECT 3 FROM DUAL
      4  /
             2
             2
             3
    scott@ORA92> -- it is not the same as:
    scott@ORA92> SELECT COUNT (empno)
      2  FROM   (SELECT empno
      3            FROM   emp
      4            WHERE  job = 'ANALYST'
      5            UNION
      6            SELECT empno
      7            FROM   emp
      8            WHERE  job = 'MANAGER')
      9  /
    COUNT(EMPNO)
               5

  • HT1338 I updated my MacBook Pro with Mountain Lion and now it is starting slow and opening with some of the programs. How can I fix the problem?

    I updated my MacBook Pro with Mountain Lion and now it is slow in starting up and loads a number of probrams. How can I fix the problem?

    Have you tried starting in Safe Mode and see if the slowness still occurs?
    Restart holding the "shift" key.
    (Expect it to take longer to start this way because it runs a directory check first.)
    If this works look in System Preferences > Users & Groups > Login items and delete any third party login items (-), you can always add them back with the (+). Also look in /Library/Startup Items. Nothing is put in that folder by default, so anything in there is yours.
    Reboot normally and test.

Maybe you are looking for

  • Is there a way to prevent Gift Voucher Email from going to Spam folder?

    Everytime I send an email to someone with a Gift Voucher or Discount Code from the system generated emails, they always end up in the Spam folder on GMail, Yahoo, etc. Is there a way to prevent emails from being labeled as Spam with this system?

  • SAPSCRIPT for Hebrew language

    Hi Experts,     I have created one sap script with hebrew language data in text element for main window. I want to add english words in the same text element while getting the output it is taking differently... example: i typed "data communication pr

  • Dvr620ku no sound on dvd

    dubbing from vcr tape to dvd. I tried two different tapes. I am using DVD-R. When dvd is played on the DVR620 I get video and audio. when played on other devices ( Computer, portable dvd player) I get video no audio. Yes, volume is turned up on other

  • Can't edit the message popup in teststand 4.2.1

    Hi, I installed the 2010 version of TestStand on my PC. Everything has been fine until today. Every time i try to edit a property loader I get the following error: Error in cal to LoadPanelEx. Parent Panel Handel: 0 UIR File Name: PropertyLoaderUI.ui

  • Strange album names in Library

    Hi- I was having some issues with my iPhoto Library working with iPhoto Buddy (gave up on that for now anyway) and looked at my Pictures--->iPhoto Library--->Albums and noticed 3 odd names (they show as just Documents- is that correct?): Pending Rota