Use of EXIST clause

Need to seek advice on the use of EXISTS clause.
What is this statement trying to do? What is the '1' in the inner SELECT statement means?
DELETE FROM a
WHERE NOT EXISTS (SELECT 1
FROM b
WHERE a.a_id = b.a_id);
What about these 2 statements doing??
SELECT * FROM a WHERE EXISTS (SELECT 1 FROM b WHERE a.a_id = b.a_id);
DELETE FROM a
WHERE EXISTS (SELECT 1 FROM b WHERE a.a_id = b.a_id);

have a look at http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:953229842074 for a complete explanation of how an "exists" and an "in" is executed. For "not in" and "not exists", look here: http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:442029737684
greetings
Freek D
Freek and Mona are correct in that the 1 is just a place holder, because you need to SELECT something. However, the EXISTS clause actually returns TRUE or FALSE depending on whether the SELECT statement finds a row.
EXISTS is similar to IN using a SELECT statement. The advantage of EXISTS, particularly when you can use a correlated sub-query, is that it stops looking as soon as it finds a single row that matches the criteria in the SELECT statement, where an IN clause will return all the rows that match, including duplicates

Similar Messages

  • Use of EXISTS clause in Interface

    I want to build an interface from one table but using an exist clause to check the data change in the same table.
    In SQL statement it can be expressed as follows
      SELECT PB.PROJECT_KEY, COUNT (DISTINCT DW_PROJECT_BUILDING_KEY)
        FROM DW_PROJECT_BUILDING PB
       WHERE     EXISTS
                    (SELECT 1
                       FROM DW_PROJECT_BUILDING PB1
                      WHERE     PB1.PROJECT_KEY = PB.PROJECT_KEY
                            AND PB1.RECORD_STATUS_ID = 1)
             AND PB.RECORD_STATUS_ID = 1
             AND TRUNC (PB.LOAD_DT) >= '03-OCT-2013'
    GROUP BY PB.PROJECT_KEY;
    How can I build this SQL with exists clause in the interface ?
    Thanks

    Create the interface with DW_PROJECT_BUILDING table and give this table a name PB.
    Now put one filter on the table with the conditions that you have just mentioned in the query above, with the exist statement.
    I assume data from this table is targeted into one more aggregated table: here is the definition for the table:
    CREATE TABLE PROJECT_BUILDING_AGGR
    (PROJ_BUILD_KEY VARCHAR2(20),
    PROJECT_KEY varchar2(20));
    perform mapping like :
    PROJECT_KEY=PB.PROJECT_KEY
    PROJ_BUILD_KEY=count(distinct PB.DW_PROJECT_BUILDING_KEY)
    Select IKM as IKM SQL control append.
    FLOW control as false.
    run the interface, it is giving something like this for me, I hope this is according to your requirement:
    insert into
    ORACLE_SOURCE.PROJECT_BUILDING_AGGR
    PROJ_BUILD_KEY,
    PROJECT_KEY
    select
        PROJ_BUILD_KEY,
    PROJECT_KEY  
    FROM (
    select
    count(distinct PB.DW_PROJECT_BUILDING_KEY) PROJ_BUILD_KEY,
    PB.PROJECT_KEY PROJECT_KEY
    from
    ORACLE_SOURCE.DW_PROJECT_BUILDING   PB
    where
    (1=1)
    And (EXISTS
                    (SELECT 1
                       FROM DW_PROJECT_BUILDING PB1
                      WHERE     PB1.PROJECT_KEY = PB.PROJECT_KEY
                            AND PB1.RECORD_STATUS_ID = 1)
             AND PB.RECORD_STATUS_ID = 1
             AND TRUNC (PB.LOAD_DT) >= '03-OCT-2013')
    Group By PB.PROJECT_KEY
    )    ODI_GET_FROM

  • Exists clause in plsql query

    HI I see that by the use of exists clause while joining
    1) oralce provides a better execution plan ... and 2) it eliminates duplicates automatically
    but my question is how to access the columns of the inner tables in the select clause ?
    EG:
    select a.sno, b.course_name
    from a,b
    where a.cid=b.cid
    ----------------------in the below query How do i access b.course_name in the select clause? similarly even if it contains more tables nested, i should be able to access the column of the inner tables from the select clause . How to do this . hope i am clear
    select a.sno from a where exists ( select 1 from b where b.cid=a.cid)

    You cannot access columns from tables in an EXISTS (or NOT EXISTS) clause outside of that clause. You can only select data from tables (and other objects) that you are actually selecting from.
    Justin

  • Spatial query inside the exists clause return ora-13226

    The following does not work:
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW' ) = 'TRUE');
    ERROR at line 1:
    ORA-13226: interface not supported without a spatial index
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 302
    ORA-06512: at line 1
    The following does work:
    select b.* from states a,
    counties b where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW') = 'TRUE';
    I found bug 1243095 telling that this is not a bug but a limitation of the spatial operator. It cannot be invoked on a table that is not spatially indexed. In fact, the table is indexed but oracle cannot find the spatial index because table b(counties) is declared outside the EXISTS clause.
    In my case, I use object table. I cannot use the workaround specified above because I should use the DISTINCT clause but I cannot define the MAP and ORDER function (this is a general query).
    I've found another workaround :
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (a.geom, b.geom, 'mask=CONTAINS querytype=WINDOW') = 'TRUE');
    but sdo_relate still doesn't use the spatial index of table b (even if I specify it explicitely in the operator) and the query is very slow (more than 15 minutes).
    Is there a better workaround ?

    OK but I work in object model.
    And if I don't use the EXISTS clause, I must use the distinct clause.(I used the exists because of that)
    If I will to retrieve all the country that have at least a state beginning with the C letter, I will wrote :
    select c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    (It is a simplified request to express the problem)
    In this case, I must use the distinct clause to select one occurence of each country objet (one country may contains more than one state beginning with C).
    select distinct c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    For that, I must define a MAP or ORDER function for EACH type used in the country object.
    My first question is : I must retrieve all different country objects. Why the request doesn't use the MAP or ORDER function of the country type to distinct them ? Is there another syntax (or a hint) to express that ?
    In this case, it will make an ORA-00932 : incoherent datatype because the type of the nested table column cannot contain map or order method.
    Any suggestion ?
    Thanks in advance.

  • Execution of subquery of IN and EXISTS clause.

    Hi Friends,
    Suppose we have following two tables:
    emp
    empno number
    ename varchar2(100)
    deptno number
    salary number
    dept
    deptno number
    location varchar2(100)
    deptname varchar2(100)
    status varchar2(100)
    Where dept is the master table for emp.
    Following query is fine to me:
    SELECT empno, ename
    FROM emp,dept
    WHERE emp.deptno = dept.deptno
    AND emp.salary >=5000
    AND dept.status = 'ACTIVE';
    But I want to understand the behaviour of inline query (Used with IN and EXISTS clause) for which I have used this tables as an example (Just as Demo).
    1)
    Suppose we rewrite the above query as following:
    SELECT empno, ename
    FROM emp
    WHERE emp.salary >=5000
    AND deptno in (SELECT deptno FROM dept where status = 'ACTIVE')
    Question: as shown in above query, suppose in our where clause, we have a condition with IN construct whose subquery is independent (it is not using any column of master query's resultset.). Then, will that query be executed only once or will it be executed for N number of times (N= number of records in emp table)
    In other words, how may times the subquery of IN clause as in above query be executed by complier to prepared the subquery's resultset?
    2)
    Suppose the we use the EXISTS clause (or NOT EXISTS clause) with subquery where, the subquery uses the field of master query in its where clause.
    SELECT E.empno, E.ename
    FROM emp E
    WHERE E.salary >=5000
    AND EXISTS (SELECT 'X' FROM dept D where status = 'ACTIVE' AND D.deptno = E.deptno)
    Here also, I got same confusion. For how many times the subquery for EXISTS will be executed by oracle. For one time or for N number of times (I think, it will be N number of times).
    3)
    I know we can't define any fix thumbrule and its highly depends on requirement and other factors, but in general, Suppose our main query is on heavily loaded large transaction table and need to check existance of record in some less loaded and somewhat smaller transaction table, than which way will be better from performance point of view from above three. (1. Use of JOIN, 2. Use of IN, 3. Use of EXISTS)
    Please help me get solutions to these confusions..
    Thanks and Regards,
    Dipali..

    Dipali,
    First, I posted the links with my name only, I don;t know how did you pick another handle for addressing it?Never mind that.
    >
    Now another confusion I got.. I read that even if we used EXISTS and , CBO feels (from statistics and all his analysis) that using IN would be more efficient, than it will rewrite the query. My confusion is that, If CBO is smart enough to rewrite the query in its most efficient form, Is there any scope/need for a Developer/DBA to do SQL/Query tuning? Does this means that now , developer need not to work hard to write query in best menner, instade just what he needs to do is to write the query which resluts the data required by him..? Does this now mean that now no eperts are required for SQL tuning?
    >
    Where did you read that?Its good to see the reference which says this.I haven't come across any such thing where CBO will rewrite the query like this. Have a look at the following query.What we want to do is to get the list of all teh departments which have atleast one employee working in it.So how would be we write this query? Theremay be many ways.One,out of them is to use distinct.Let's see how it works,
    SQL> select * from V$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SQL> set timing on
    SQL> set autot trace exp
    SQL> SELECT distinct  D.deptno, D.dname
      2        FROM     scott.dept D,scott.emp E
      3  where e.deptno=d.deptno
      4  order by d.deptno;
    Elapsed: 00:00:00.12
    Execution Plan
    Plan hash value: 925733878
    | Id  | Operation                     | Name    | Rows  | Bytes | Cost (%CPU)| T
    ime     |
    |   0 | SELECT STATEMENT              |         |     9 |   144 |     7  (29)| 0
    0:00:01 |
    |   1 |  SORT UNIQUE                  |         |     9 |   144 |     7  (29)| 0
    0:00:01 |
    |   2 |   MERGE JOIN                  |         |    14 |   224 |     6  (17)| 0
    0:00:01 |
    |   3 |    TABLE ACCESS BY INDEX ROWID| DEPT    |     4 |    52 |     2   (0)| 0
    0:00:01 |
    |   4 |     INDEX FULL SCAN           | PK_DEPT |     4 |       |     1   (0)| 0
    0:00:01 |
    |*  5 |    SORT JOIN                  |         |    14 |    42 |     4  (25)| 0
    0:00:01 |
    |   6 |     TABLE ACCESS FULL         | EMP     |    14 |    42 |     3   (0)| 0
    0:00:01 |
    Predicate Information (identified by operation id):
       5 - access("E"."DEPTNO"="D"."DEPTNO")
           filter("E"."DEPTNO"="D"."DEPTNO")
    SQL>
    SQL> SELECT distinct  D.deptno, D.dname
      2        FROM     scott.dept D,scott.emp E
      3  where e.deptno=d.deptno
      4  order by d.deptno;
        DEPTNO DNAME
            10 ACCOUNTING
            20 RESEARCH
            30 SALES
    Elapsed: 00:00:00.04
    SQL>So CBO did what we asked it do so.It made a full sort merge join.Now there is nothing wrong in it.There is no intelligence added by CBO to it.So now what, the query looks okay isn't it.If the answer is yes than let's finish the talk here.If no than we proceed further.
    We deliberately used the term "atleast" here.This would govern that we are not looking for entirely matching both the sources, emp and dept.Any matching result should solve our query's result.So , with "our knowledge" , we know that Exist can do that.Let's write teh query by it and see,
    SQL> SELECT   D.deptno, D.dname
      2        FROM     scott.dept D
      3          WHERE    EXISTS
      4                 (SELECT 1
      5                  FROM   scott.emp E
      6                  WHERE  E.deptno = D.deptno)
      7        ORDER BY D.deptno;
        DEPTNO DNAME
            10 ACCOUNTING
            20 RESEARCH
            30 SALES
    Elapsed: 00:00:00.00
    SQL>Wow, that's same but there is a small difference in the timing.Note that I did run the query several times to elliminate the physical reads and recursive calls to effect the demo. So its the same result, let's see the plan.
    SQL> SELECT   D.deptno, D.dname
      2        FROM     scott.dept D
      3          WHERE    EXISTS
      4                 (SELECT 1
      5                  FROM   scott.emp E
      6                  WHERE  E.deptno = D.deptno)
      7        ORDER BY D.deptno;
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 1090737117
    | Id  | Operation                    | Name    | Rows  | Bytes | Cost (%CPU)| Ti
    me     |
    |   0 | SELECT STATEMENT             |         |     3 |    48 |     6  (17)| 00
    :00:01 |
    |   1 |  MERGE JOIN SEMI             |         |     3 |    48 |     6  (17)| 00
    :00:01 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| DEPT    |     4 |    52 |     2   (0)| 00
    :00:01 |
    |   3 |    INDEX FULL SCAN           | PK_DEPT |     4 |       |     1   (0)| 00
    :00:01 |
    |*  4 |   SORT UNIQUE                |         |    14 |    42 |     4  (25)| 00
    :00:01 |
    |   5 |    TABLE ACCESS FULL         | EMP     |    14 |    42 |     3   (0)| 00
    :00:01 |
    Predicate Information (identified by operation id):
       4 - access("E"."DEPTNO"="D"."DEPTNO")
           filter("E"."DEPTNO"="D"."DEPTNO")Can you see a keyword called Semi here? This means that Oralce did make an equi join but not complete.Compare the bytes/rows returned from this as well as cost with the first query.Can you notice the difference?
    So what do we get from all this?You asked that if CBO becomes so smart, won't we need developers/dbas at that time?The answer is , what one wants to be, a monkey or an astranaut? Confused,read this,
    http://www.method-r.com/downloads/doc_download/6-the-oracle-advisors-from-a-different-perspective-karen-morton
    So it won't matter how much CBO would become intelligent, there will be still limitations to where it can go, what it can do.There will always be a need for a human to look all the automations.Rememember even the most sofisticated system needs some button to be pressed to get it on which is done by a human hand's finger ;-).
    Happy new year!
    HTH
    Aman....

  • Where Exist clause to improve query performance

    select * from emp
    where emp_code in (select emp_code from emp_acct)
    it is said tht its always better to use where exist clause instead of IN.
    I hav written the same query using where Exist,
    select * from emp e
    where exists (select null from emp_acct ea where e.emp_code = ea.emp_acct)
    but both these queries are sharing the same cost.
    is there is any other way to use exist to decrease cost of the query.
    ---Piyush

    You can't compare the cost of two different queries.
    You can't relate cost to the running time of the query.
    Having said that, why is this not just a join?
    select e.*
    from emp e
    , emp_acct ea
    where e.emp_code = ea.emp_codecheers,
    Anthony

  • Can any one tell me how to use EXISTS clause inplace of IN operator.

    Hi All,
    Can any one tell me how to use EXISTS clause AND (JC.EMPL_ID, JC.EMPL_RCD) inplace of IN operator.
    SELECT COUNT (1)
    FROM SYSADM.OHR_PERS_CURR PC
    , SYSADM.OHR_JOB_CURR JC
    WHERE PC.EMPL_ID = JC.EMPL_ID
    AND (JC.EMPL_ID, JC.EMPL_RCD) in (
    SELECT HS.EMPL_ID, HS.EMPL_RCD
    FROM SYSADM.HU_SCRTY_JOB HS, ODSHR.OHR_SCRTY_USER_CFG OS
    WHERE HS.HU_SCRTY_CFG_ID = OS.HU_SCRTY_CFG_ID
    AND OS.DB_LOGIN = USER)
    Thank you.

    SELECT COUNT (1)
    FROM SYSADM.OHR_PERS_CURR PC
    , SYSADM.OHR_JOB_CURR JC
    WHERE PC.EMPL_ID = JC.EMPL_ID
    AND EXISTS (
    SELECT null
    FROM SYSADM.HU_SCRTY_JOB HS, ODSHR.OHR_SCRTY_USER_CFG OS
    WHERE HS.HU_SCRTY_CFG_ID = OS.HU_SCRTY_CFG_ID
    AND OS.DB_LOGIN = USER
    AND HS.EMPL_ID = JS.EMPL_ID AND HS.EMPL_RCD = JC.EMPL_RCD)
    But why ?
    Rgds.

  • In Oracle, Can i use if exits clause in a query?

    In Oracle, Can i use if exits clause in a query?
    For example, "Drop table if exists tablename"
    Is the above command valid in oracle?
    If not then is there any equivalent for if exists clause?

    Here is the SP code code that might help you to Drop a table if it exisit, whith out throwing an error if the table is not present.
    create or replace PROCEDURE DROP_TABLE(TabName in Varchar2)
    IS
    temp number:=0;
    tes VARCHAR2 (200) := TabName;
    drp_stmt VARCHAR2 (200):=null;
    BEGIN
    select count(*) into temp from user_tables where TABLE_NAME = tes ;
    if temp =1 then
    drp_stmt := 'Drop Table '||tes;
    EXECUTE IMMEDIATE drp_stmt;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    END DROP_TABLE;
    Call this SP in your Scripts by : CALL DROP_TABLE ('<Table Name>')
    Hope this Helps!
    Regards,
    Kaarthiik

  • Not able to migrate a query with not exist clause

    Hi all,
    I'm using Toplink 10.1.3 and I am trying to rewrite the following query with Expression Framework:
    select distinct r.e_ogg_oper_k_oggetto
    FROM regola_accettazione_oper_banc r, oggetto_operazione_bancaria o
    where not exists (
    select 1
    FROM limitaz_ogg_tipo_oper_banc l
    where nvl(l.d_fine_validita,trunc(sysdate)+1)>trunc(sysdate)
    and l.d_inizio_validita <= trunc(sysdate)
    and l.e_tpodv_k_tipo_operazione=:appoggio.tipo_operaz
    and l.e_ogg_oper_k_oggetto=r.e_ogg_oper_k_oggetto
    and l.e_uni_oper_k_unita_oper_util= :appoggio.e_uni_oper_k_unita_oper_esegui )
    and r.e_oper_ban_k_operaz_bancaria=:appoggio.form
    and r.e_ogg_oper_k_oggetto=o.k_oggetto
    and o.e_ogg_oper_k_oggetto is null
    and o.k_oggetto != nvl(:appoggio.oggetto_autom,,'0')
    and o.k_oggetto like substr(:appoggio.oggetto,1,2)||'%'
    and r.d_inizio_validita <= :appoggio.d_contab
    and to_date(nvl(to_char(r.d_fine_validita,DD/MM/YYYY'),31/12/3999'),'DD/MM/YYYY')> :appoggio.d_contab
    and o.f_natura_oggetto in ('G','P') and r.f_oggetto_automatizzato!='S'
    I'm not able to "attach" the not exist clause to the rest of query.
    How can I do it?
    Thank you very much.

    Not exists can be used in an expression through using a ReportQuery sub-query.
    i.e.
    ExpressionBuilder outerBuilder = new ExpressionBuilder();
    ReadAllQuery outerQuery = new ReadAllQuery(Employee.class, outerBuilder);
    ExpressionBuilder subBuilder = new ExpressionBuilder();
    ReportQuery subQuery = new ReportQuery(Address.class, subBuilder);
    subQuery.addAttribute("id");
    subQuery.setSelectionCriteria(
    subBuilder.get("city").equal(outerBuilder.get("address").get("city")
    .and(subBuilder.notEqual(outerBuilder.get("address")))));
    outerQuery.setSelectionCriteria(
    outerBuilder.notExists(subQuery));
    List results = (List) session.executeQuery(outerQuery);
    Refer to the documentation section on sub-queries for more information.
    I would suggest simlpifying the where clause until you get the sub-query working to start.
    You can also always use a custom SQL query in TopLink.

  • SQL Loader to append data in same table but using differnet WHEN clauses

    In my data file i have a header record and a detail record identified by Record_type = 1 and 2 respectively.
    The Database table has all the columns to capture detail records but i want to capture jus one column of header record now also in my existing table. So i have added that column (DATA_DATE)in my table but how to capture that value ?
    im writing my control file using two WHEN clauses, something like -
    load data
    into table t_bdn
    append
    when RECORD_TYPE = '2'
    FIELDS TERMINATED BY "|" TRAILING NULLCOLS
    SEQUENCE_NO
    , RECORD_TYPE
    , DISTRIBUTOR_CODE
    , SUPPLIER_CODE
    , SUPPLIER_DISTRIBUTOR_CODE
    , DISTRIBUTOR_SKU
    , SUPPLIER_SKU
    when RECORD_TYPE = '1'
    FIELDS TERMINATED BY "|" TRAILING NULLCOLS
    SEQUENCE_NO FILLER
    , RECORD_TYPE FILLER
    , CREATE_DATE FILLER
    , DATA_DATE "NVL(to_date(:DATA_DATE, 'YYYY/MM/DD'),to_date('9999/12/31', 'YYYY/MM/DD'))"
    im getting error " expecting INTO and foung WHEN RECORD_TYPE = '1' "
    if i give iNTO second time it will append a new row altogether in my table but i want the same row to be updated with this DATA_DATE value coming from RECORD_TYPE =1 and header record has 4 delimited data text fields only and i am interested in fetching just the 4th column..
    KIndly suggest what to do ?

    Ravneek, I could be wrong but sqlldr is a 'load' program, that is, it inserts data. I am unaware of any ability to update existing rows as you seem to want. What you appear to want to do is more the job of a merge statement.
    I would look at writing a pro* language, a .net, or a java program to perform inserts where some or all of the newly inserted rows are also to be updated.
    From the manual: (Oracle® Database Utilities 10g Release 2 (10.2) Part Number B14215-01)
    Updating Existing Rows
    The REPLACE method is a table replacement, not a replacement of individual rows. SQL*Loader does not update existing records, even if they have null columns. To update existing rows, use the following procedure:
    1. Load your data into a work table.
    2. Use the SQL language UPDATE statement with correlated subqueries.
    3. Drop the work table.
    HTH -- Mark D Powell --

  • IN clause Vs Exist clause

    Which is better to use in select query IN or EXIST clause ??

    Which better in terms of what performance,readability ? Performance is the same  but EXISTS is more readable and easy understand in my opinion.
    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

  • IN vs EXISTS clause

    I have seen in some of the posts that using 'EXISTS' clause in place of 'IN' yields better performance results.
    For example
    update customer
    set type = 'emp'
    where cid in (select empid from employees)
    I have 1 million rows in customer and 500k rows in employee table in this case is it better to use 'EXISTS' instead of 'IN' clause. Also does datatype of the column have effect on the type of clause being used.
    Any suggestions/inputs ???
    Thanks

    Andre Crone recently published some interesting thoughts on the Amis blog. Check it out.
    Cheers, APC

  • Update statement with EXISTS clause

    I saw this code in one of the procedures we are using ... is it possible to avoid EXIST caluse:
    update table_x p
    set p.internal_issue_ky = (select sh.internal_issue_ky
    from security_history sh, XT_SECURITY xs
    where sh.internal_wins_issue_id = xs.internal_wins_issue_id
    and sh.as_of_dt = xs.as_of_date
    and p.internal_wins_issue_id = sh.internal_wins_issue_id
    and p.effective_dt between sh.as_of_dt and sh.next_as_of_dt
    where exists
    (select sh.internal_issue_ky
    from security_history sh, XT_SECURITY xs
    where sh.internal_wins_issue_id = xs.internal_wins_issue_id
    and sh.as_of_dt = xs.as_of_date
    and p.internal_wins_issue_id = sh.internal_wins_issue_id
    and p.effective_dt between sh.as_of_dt and sh.next_as_of_dt
    Thanks.

    Without the EXISTS, every record in the table will be updated, and those that don't exist in the subquery will be updated with NULL. The EXIST clause ensures that only those records that form the subset in the subquery are updated, and is necessary here.

  • I want a new and more powerful (non-Apple) wireless router but I still want to use my existing Time Capsule to continue with my Time Machine backups and I still need the Time Capsule's Network Attached Storage (NAS) features and capabilities

    THE SHORTER STORY
    My goal is to successfully use my existing Time Capsule (TC) with a new and more powerful wireless router. I need a new and more powerful wireless router in order to reach a distant Denon a/v receiver that is physically located in a master bedroom some 50 feet away from my modem. I need to provide this Denon a/v receiver with an Internet connection so that it can obtain its firmware updates and I need to connect this Denon a/v receiver to my network in order to use its AirPlay feature. I believe l still need the TC's Network Attached Storage (NAS) features because I am not sure if the new wireless router will provide me with the NAS like features / capabilities I need to share files between my two Apple laptops with OS X 10.8.2. And I know that I absolutely need my TC's seamless integration with Apple's Time Machine (TM) application in order to continue to make effortless backups of my two Apple laptops. To my knowledge nothing works with TM like Apple's TC. I also need the hard disk storage space built into the TC.
    I cannot use a long wired Ethernet cable connection in this apartment and I cannot use power-line adapters. I have read that wireless range extenders and repeaters are difficult to successfully set-up and that they will reduce data speeds, especially so when incorrectly set-up. I cannot relocate my modem and/or primary base station wireless router.
    In short, I want to use my TC with my new and more powerful wireless router. I need to stop using the TC to connect to the modem. However, I still need the TC for seamless TM backups. I also need to use the TC's built in hard drive for storage. And I may still need the TC's NAS capabilities to share files wirelessly between laptops because I am assuming the new wireless router will not provide NAS capabilities for OS X 10.8.2 (products like this/non-Apple products rarely seem to work with OS X 10.8.2/Macs to provide NAS features and capabilities). Finally, I want to continue to use my Apple laptop and AirPlay to wirelessly access and play my iTunes music collection stored on the TC's hard drive. I also want to continue to use my Apple laptop, AirPlay and Apple TV to wirelessly watch movies and TV shows stored on the additional external hard drive connected to the TC via USB. Can someone please advise on how to set-up my new Asus wireless router with my existing TC in such a way to accomplish all of this?
    What is the best configuration or set-up to accomplish my above goals?
    Thank you in advance for your assistance!!!
    THE FULL STORY
    I live in an apartment building where my existing Time Capsule (TC) is located in my living room and serves many purposes. Specially, my TC is at least all of the following:
    (1) Wi-Fi router connected to Comcast Internet service via Motorola SB6121 cable modem - currently the TC is the Wi-Fi base station that connects to the modem and has the gateway address to the Internet. The TC now provides the DHCP service for the Wi-Fi network.
    (2) Wireless router providing Internet and Wi-Fi network access to several Wi-Fi clients - two Apple laptop computers, an iPod touch, an iPad and an iPhone all connect wirelessly to the Internet via the TC.
    (3) Wired Ethernet router providing Internet and Wi-Fi network access to three different devices - a Panasonic TV, LG Blu-Ray player and an Apple TV each use one of the three LAN ports on the back of the TC to gain access to the Internet.
    (4) Primary base station in my attempt to extend my wireless network to a distant (located far away) Denon a/v receiver requiring a wired Ethernet connection - In addition to the TC, which is my primary base station, I am also using a second extended Wi-Fi base station (a Netgear branded product) to wirelessly extend my WiFi network to a Denon receiver located in the master bedroom and requiring a wired Ethernet connection. I cannot use a wired Ethernet connection to continuously travel from the living room to the master bedroom. The distance is too great as I cannot effectively hide the Ethernet cable in this apartment.
    (5) Time Machine (TM) backup facilitator - I use my TC to wirelessly back-up two Apple laptops using Apple's Time Machine (TM) application. However, I ran out of storage space on my TC and therefore added external storage to it. Specifically, I added an external hard drive to my TC via the USB port on the back of the TC. I now use this added external hard drive connected to the TC via USB as the destination storage drive for my TM back-ups. I have partitioned the added external hard drive, and each of the several partitions all have enough storage space (e.g., each of the two partitions used by TM are sized at three times the hard drive space of each laptop, etc.). Everything works flawlessly.
    (6) Network Attached Storage (NAS) - In addition to using the TC's Network Attached Storage (NAS) capabilities to wirelessly back-up two Apple laptops via TM, I also store other additional files on both (A) the hard drive built into the TC and (B) the additional external hard drive connected to the TC via USB (there are additional separate partitions on this drive for these other additional and non-TM backup files).
    I use the TC's NAS feature with my Apple laptop and AirPlay to wirelessly access and play my iTunes music collection stored on the TC's hard drive. I also use my Apple laptop, AirPlay and Apple TV to wirelessly watch movies and TV shows stored on the additional external hard drive connected to the TC via USB. Again, everything works wirelessly and flawlessly. (Note: the Apple TV is connected to the network via Ethernet and a LAN port on the back of the TC).
    The issue I am having is when I try to listen to music via Apple's AirPlay in the master bedroom. This master bedroom is located at a distance of two rooms away from the TC's current location in the living room, which is a distance of about 50 feet. This apartment has a long rectangular floor plan where each room is connected to the next in a straight line. In order to use AirPlay in the master bedroom I am using a second extended Wi-Fi base station (a Netgear branded product) to wirelessly extend my WiFi network to a Denon receiver located in the master bedroom and requiring a wired Ethernet connection. This additional base station connects wirelessly to the WiFi network provided by my TC and then gives my Denon receiver the wired Ethernet connection it needs to use AirPlay. I have tried moving my iTunes music directly onto my laptop's hard drive, and then I used AirPlay on this same laptop to connect to the Denon receiver. I always get a successful connection and the song plays, but the problem is that the connection inevitably drops.
    I live in an apartment building and all of the many wireless routers in this building create a great deal of WiFi interference on both the 2.4 GHz and 5GHz bands. I have tried connecting the Netgear product to each the 2.4 and 5 GHz bands, but neither band can successfully maintain a wireless connection between the TC and the Netgear product. I also attempted to maintain a wireless connection to an iPod touch using the 2.4 GHz band and AirPlay on this iPod touch to play music on the Denon receiver. Again, I was able to establish a connection and successfully play music, but after a few minutes the connection dropped and the music stopped playing. I therefore have concluded that I have a poor wireless connection in the master bedroom. I can establish a connection, but it is intermittent with frequent drops. I have verified this with both laptops by working in the master bedroom for an entire day on both laptops. The Internet connection in this master bedroom proved to drop out frequently - about once an hour with the laptops. The wireless connection and the frequency of its dropout are far worse with the iPod touch and an iPhone.
    I cannot relocate the TC. Also, this is an apartment and I therefore cannot extend the range of my network with Ethernet cable (I cannot drill through walls/ceilings, etc.). It is an old building with antiquated wiring and power-line adapters are not likely to function properly, nor can I spare the direct power outlet required with a power-line adapter. I simply need every outlet I can get and cannot afford to block any direct outlet.
    My solution is to use a more powerful wireless router. I found the ASUS RT-AC66U Dual-Band Wireless-AC1750 Gigabit Router which will likely provide a better connection to my wireless Internet in the master bedroom than the TC. The 802.11ac band of this Asus wireless router is totally useless to me, but based on what I have read I believe this router will provide a stronger connection at greater distances then my TC. And I will be ready for 802.11ac when it becomes more widely available.
    However, I still need to maintain the TC's ability to work seamlessly with TM to backup my two laptops. Also, I doubt the new Asus router will provide OS X 10.8.2 with NAS like features and capabilities. Therefore, I still would like to use the TC's NAS capabilities to share files on my network wirelessly assuming the Asus wireless router fails to provide this feature. I need a new and more powerful wireless router, but I need to maintain the TC's NAS features and seamless integration with TM. Finally, I want to continue to use my Apple laptop and AirPlay to wirelessly access and play my iTunes music collection stored on the TC's hard drive. I also want to continue to use my Apple laptop, AirPlay and Apple TV to wirelessly watch movies and TV shows stored on the additional external hard drive connected to the TC via USB. Can someone advise on how to set-up my existing TC with this new Asus wireless router in such a way to accomplish all of this?
    Modem
    Motorola SB6121 SURFboard DOCSIS 3.0 Cable Modem
    Existing Wireless Router and Primary Wi-Fi Base Station - Apple Time Capsule
    Apple Time Capsule MC343LL/A 1TB Sim DualBand (purchased June 2010, likely the Winter 2009 Model)
    Desired New Wireless Router and Primary Wi-Fi Base Station - Non-Apple Asus
    ASUS RT-AC66U Dual-Band Wireless-AC1750 Gigabit Router
    Extended Wi-Fi Base Station - Provides an Ethernet Connection to a Denon A/V Receiver Two Rooms Away from the Modem
    Netgear Universal Dual Band Wireless Internet Adapter for TV & Blu-Ray (WNCE3001)
    Addition External Hard Drive Attached to the Existing Apple Time Capsule via USB
    WD My Book Studio 4TB Mac External Hard Drive Storage USB 3.0
    Existing Laptops on the Wireless Network Requiring Time Machine Backups
    MacBook Air (11-inch, Mid 2012) OS X 10.8.2
    MacBook Pro (13-inch Mid 2010) OS X 10.8.2
    Other Existing Apple Products (Clients) on the Wireless Network
    iPod Touch (second generation) is model A1288.
    iPad (1st generation)
    Apple TV (3rd generation) - Quantity two (2)

    Thanks Bob Timmons.
    In regards to a Plan B, I hear ya brother. I am already on what feels like Plan Z. Getting WiFi to a far off room in an apartment building crowded with WiFi routers is a major pain.
    I am basing my thoughts on the potential of a new and more powerful router reaching the far off master bedroom based on positive reviews on cnet.com, pcmag.com and pcworld.com. All 3 of these web sites have reviewed the Asus RT-AC66U 802.11AC wireless router as well as its virtual twin cousin 802.11n router. What impressed me is that all 3 sites rated this router #1 overall in terms of both range and speed (in both the 802.11n and 802.11AC flavors). They tested the router in real world scenarios where the router needed to compete with a lot of other wireless routers. One of the sites even buried this Asus router in a media room with thick walls and inside a media cabinet. This Asus router should be able to serve my 2.4 GHz band wireless clients (iPod Touch and iPhone 4) with a 2.4GHz Wireless-N band offering some 50 feet of dependable range and a 60 Mbps throughput at that range. I am hoping that works, but it's borderline for my master bedroom. My 5 GHz wireless clients (laptops) will enjoy a 5GHz Wireless-N band offering 150 feet of range and a 200 Mbps throughput at that range. I have no idea what most of that stuff means, but I did also read that Asus could reach 300 feet and I got really excited. My mileage may vary of course and I'm sure I'm making some mistakes in my interpretation of their data. However, my Winter 2009 Time Capsule was rated by cnet.com to deliver real world performance of less than that, and 802.11AC may or may not be useful to me someday. But when this Asus arrives and provides anything other than an excellent and consistent wireless signal without drops in the master bedroom it's going right back!
    Your solution sounds great, but I have some questions. I'm using OS X 10.8.2 and Airport Utility (version 6.1 610.31) and on its third tab labeled "Wireless" the top option enables you to set "Network Mode" to either:
    Create a wireless network
    Extend a wireless network
    Off
    Given your advice to "Turn off the wireless on the TC," should I set Network Mode to Off? Sorry, I'm clueless in regards to how to turn off the wireless on the TC any other way. Can you provide specific steps on how to turn off the wireless on the TC? If what I wrote is correct then what should the rest of this Wireless tab look like, or perhaps it is irrelevant when wireless is off?
    Next, what do you mean by "Configure the TC in Bridge Mode?" Under Airports Utility's fourth tab labeled "Network" the top option "Router Mode" allows for either:
    DHCP and Nat
    DHCP Only
    Off (Bridge Mode)
    Is your advice to Configure the TC in Bridge Mode as simple as setting Router Mode to Off (Bridge Mode)? If yes, then what should the rest of this "Network" tab look like? Anything else involved in configuring the TC in Bridge Mode or is it really as simple as setting the Router Mode to "Off (Bridge Mode)"?
    How about the other tabs in Airport Utility, can they all stay as is assuming I use the same network name and password for the new Asus wireless router? Or do I need to make any other changes to the TC via Airport Utility?
    Finally, in regards to your Plan B suggestion. I agree. But do you have a Plan B for me? I would greatly appreciate any alternative you could provide. Specifically, if you needed a TC's Internet connection to reach a far off corner of your home how would you do it? In the master bedroom I need both a wired Ethernet connection for the Denon a/v receiver and wireless Internet connection for the iPhone and iPod Touch.
    Power-Line Adapters - High Cost, Blocks at Least One Wall Outlet and Does Not Solve the Wireless Need
    I actually like exactly one power-line adapter, which is the D-Link DHP-540 PowerLine AV 500 4-Port Gigabit Switch. This D-Link power-line adapter plugs into your wall outlet with a normal sized plug (regular standard power cord much like any other electronic device) instead of all of the other recommended power-line adapters that not only use at least one wall outlet but also often block the second outlet. You cannot use a power strip with a power-line adapter which is very impractical for me. And everything about my home is strange and upside down. The wiring here is a disaster and I don't have faith in its ability to carry Internet access from the living room to the master bedroom. And this D-Link power-line adapter costs $90 each and I need at least two to make the connection to the Denon A/V receiver. So, $180 on this solution and I still don't have a dependable drop free wireless connection in the master bedroom. The Denon might get its Ethernet Internet connection from the power-line adapter, but if I want to use an iPhone 4 or iPod Touch to stream AirPlay music to the Denon wirelessly (Pandora/iTunes, etc.) from the master bedroom the wireless connection will not be stable in there and I've already spent $190 on just the two power-line adapters needed.
    Extenders / Repeaters / Wirelessly Extending the Wireless Network
    I have also read great things about the Amped Wireless High Power Wireless-N 600mW Gigabit Dual Band Range Extender (Repeater) SR20000G and the My Net Wi-Fi Range Extender. The former is very powerful and the latter is easier to install. Both cost about $150 ish so similar to a new Asus router. However, everything I read about Range Extenders points to them not being very effective for a far off corner of your house wherein it's apparently hard to place the range extender in the sweet spot where it both gets a strong enough signal to actually effectively extend the wireless signal and otherwise does not reduce network throughput speeds to unacceptable speeds.
    Creating a Roaming Network By Hard Wiring with Ethernet Cable - Wife Would Say, "**** No!"
    Even Apple seems to warn against wirelessly extending your network (see: http://support.apple.com/kb/HT4145#) and otherwise strongly recommends a roaming network where Ethernet cable is used to connect two wireless base stations. However, I am in an apartment where stringing together two wireless base stations with Ethernet cable would have an extremely low wife acceptance factor (WAF). I cannot (both contractually and from a skill prospective) hide Ethernet wire in the walls or ceiling. And having visible Ethernet cable running from room-to-room would be unacceptable, especially to the wife.
    So what is left? Do you have a Plan B for me? Thanks in advance for your help!

  • This email address is already in use or you may already have an Apple ID associated with this email address. Please try again or sign in using your existing Apple ID.

    My current Apple ID, for which all of my content has been downoaded (e.g., music, apps) is associated with a work email address that I will no longer have access to in the near future.  In my Apple ID account, I noticed I had two alternate emails listed, one is my .me account and the other is my .gmail account.  I use my .gmail account, and it is the primary email I use with friends and family.  I noticed both were not verified, and when I tried to, it said they were both associated with other accounts.  I was able to log into a separate Apple ID account I must have set up at tone point with my .gmail, and I changed the email address to a new one I created.  I also deleted the gmail account from any other Apple-relted account I could think of.  I am still gettgin the same error message when I try to add it to my current Apple ID: "This email address is already in use or you may already have an Apple ID associated with this email address. Please try again or sign in using your existing Apple ID."
    My concern is this: with FaceTime and now iMessage, it seems more important than ever that I am able to use my correct email address.  With iOS5 beta, I cannot enter either my .gmail or.me accounts under "You can be reached for messages at:" as I get an error stating: Unable to verify email because it is already in use."
    How can I remedy this issue and assign my .gmail account to my Apple ID?

    Re: Cant verify Apple ID
    created by kelly218 in iTunes Store - View the full discussion
    I just spoke with a technician at Apple.  I hsven't been able to verify because the wife has the phone.  but he said all that you need to do is:
    1) Go to Settings --> iTunes Store and login with your Apple ID and pwd
    2) Go to Settings --> iCloud and login with your Apple ID and pwd
    seems that the phone requires you to login to the store first...

Maybe you are looking for