Can we use EXISTS in where condition

hi all,
can we use EXISTS (instead of IN) in where condition of a query which is not part of a subquery ?
for e.g:
update gpf_vou_sm set up_amt=0 where src_cd exists ('1101','1201');
the query works fine with the IN operator in place of EXISTS.
anybody please help.
thomas k prakash

Hi:
You can use EXISTS in where clause but not in that syntax.
UPDATE gpf_vou_sm g
   SET up_amt = 0
WHERE EXISTS (SELECT 1
                 FROM gpf_vou_sm
                WHERE src_cd IN ('1101', '1201') AND id = g.id);Using IN in your case is better...
Saad,

Similar Messages

  • Can you use home share where there are 2 itunes on the same computer but under different user profiles?

    Can you use 'Home Share' where there are 2 itunes on the same computer, but under different user profiles?

    check out method one from this support article -> How to use multiple iPods, iPads, or iPhones with one computer

  • Can I use existing games in new Games Centre

    Just updated my 3gs to OS4.1 with no problems, my question is:-
    Can I use existing games already bought & paid for at the iStore in the new Games Centre? Iv'e tried dragging them in to no avail i'm begining to think in that money making fashion of Apple that you can only use newly purchased games.

    You mean in the money making fashion of Apple which doesn't make any money off the sale of paid apps with all free apps hosted and distributed by Apple at no charge to the developers with free apps? Apple keeps a percentage of the sales price for paid apps to cover associated expenses. The bulk of the revenue for paid apps is paid to the app developers with the developer for a paid app setting the price for their app.
    An app must be updated by the developer for the app to be included with the Game Center no different from an app needing to be updated by the developer for iOS4 to be suspended when leaving the app instead of being quit.

  • Can i use Decode in Where clause

    Hi,
    Can i use Decode in Where clause Please Do the need full on the same.
    Thanks,
    Sanjeev.

    set serveroutput on
    DECLARE
    posn  PLS_INTEGER := 0;
    empid PLS_INTEGER := 178;
    x     NUMBER;
    BEGIN
      SELECT NVL(SUM(ah.quantity * ah.saleprice * ap.payoutpct), 0)
      INTO x
      FROM accessoryhistory ah, payoutpercentage ap,
      sku s, store st
      WHERE empid = DECODE(posn,
                              0, st.areadir,
                              1, st.areamgr,
                              2, NVL(st.storemgr1, st.storemgr2),
                              3, NVL(st.asstmgr1, NVL(st.asstmgr2,
                           st.asstmgr3)))
      AND ah.statustype IN ('ACT', 'DEA')
      AND ah.store = st.store
      AND s.dbid = ah.dbid
      AND s.sku = ah.sku
      AND ap.productgroup = s.productgroup
      AND ap.position = posn;
      dbms_output.put_line(x);
    END;
    /http://psoug.org/reference/decode_case.html

  • I find it annoying that you can't use aliases in where statements

    I find it annoying that you can't use aliases in where
    statements
    for example:
    SELECT TOP 1
    CAST(amount
    / ( CASE WHEN ISNULL(rate, 0) <> 0 THEN rate
    ELSE 1
    END ) AS NUMERIC(10, 2)) AS num
    FROM table
    WHERE num > 1
    ORDER BY num
    Are there any workarounds?

    > I find it annoying that you can't use aliases in where
    statements
    This isn't really (or... "at all") a CF question. You're
    better off asking
    this sort of thing on a SQL Server forum.
    You could use a derived table, I guess:
    select top 1 num
    from (
    SELECT
    CAST(amount
    / ( CASE WHEN ISNULL(rate, 0) <> 0 THEN
    rate
    ELSE 1
    END ) AS NUMERIC(10, 2)) AS num
    FROM table
    where num > 1
    order by num
    (that might not preserve the intent of you SQL (sorry: it's
    late, I'm
    tired), but you get the idea.
    Adam

  • Can I use existing repository for master repository?

    can I use existing repository (for example repository from oracle designer )
    for master repository? could you give me please an explanation
    thanks

    You can use Existing repository for your master Repository.
    Or you can create a new schema in your database and create
    master repository on that schema.
    I hope this answers your question

  • Can we use Case in Where Clause along with Exists

    Hi Everybody,
    Can we use Case in the where clause with exists? As i have a requirement in which i have to check whether value exists in 6 views, now depending on some value(gns_type )of select clause i have to attach a paticular exists else the performance dies.
    Please go through the query any suggestion appreciated.
    Thanks
    SELECT count(*)
    FROM
    (SELECT eah.changed_date,
    decode(eua.is_deleted, 'N', decode(eah.alert_type, NULL, 'GN', 'R', 'GAR', 'G', 'GAG', 'Y', 'GAY'), 'Y', decode(eah.alert_type, 'R', 'GDR', 'G', 'GDG', 'Y', 'GDY', NULL, 'GN'), NULL, 'GN') AS
    alert_type,
    decode(eac.pta_line, 'N', '') ptaline,
    eac.exp_type_desc,
    eac.supplier_name,
    eac.transaction_id,
    eah.gns_type,
    eac.po_amount,
    eac.po_end_date,
    eah.notes,
    eua.is_deleted,
    eac.expenditure_type,
    eua.gns_alert_summary_id,
    eah.changed_date alert_date,
    eua.user_alert_id,
    eah.reference_number,
    decode(eac.cms_pta_line,'N','',eac.cms_pta_line) cms_pta_line,
    cms_po_amount,
    cms_po_end_date,
    mgns.is_decommitted,
    eac.gns_alert_id,
    eah.gns_type source_name
    FROM xxdl.xxdl_sc_gns_alerts_summary eah,
    xxdl.xxdl_sc_gns_detail_alerts eac,
    xxdl.xxdl_sc_gns_user_alerts eua,
    xxdl.xxdl_sc_manage_gns_master mgns
    WHERE eah.gns_alert_summary_id = eac.gns_alert_summary_id
    AND eah.gns_alert_summary_id = eua.gns_alert_summary_id
    AND eah.transaction_id = eac.transaction_id
    AND eah.transaction_id = mgns.transaction_id)
    a
    WHERE(EXISTS
    (SELECT 1
    FROM xxdl_sc_mng_gns_pta_req_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS( SELECT 1
    FROM xxdl_sc_mng_gns_pta_inv_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS(SELECT 1
    FROM xxdl_sc_mng_gns_pta_req_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS(SELECT 1
    FROM xxdl_sc_mng_gns_pta_inv_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS( SELECT 1
    FROM xxdl_sc_mng_gns_pta_po_sc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    OR
    EXISTS (SELECT 1
    FROM xxdl_sc_mng_gns_pta_po_hc_v x
    WHERE x.transaction_id = a.transaction_id
    AND x.source_name = a.source_name
    AND x.project_id = 69309
    AND x.task_id = 242528
    AND x.award_id = 34694)
    AND TRUNC(alert_date) >= TRUNC(add_months(sysdate, -1))
    AND TRUNC(alert_date) <= TRUNC(sysdate)
    AND is_deleted = 'N'
    ORDER BY changed_date DESC

    you can do
    WHERE
    CASE WHEN (something) THEN
      CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END
               WHEN (something else) THEN
         CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END      
    END = 1Looking at your current query, it looks like all those exist statements could be a lot neater, maybe like:
    WHERE (69309,242528,34694) IN
    (SELECT project_id,task_id,award_id FROM
      (Select project_id,task_id,award_id,transaction_id,source_name
      FROM
      xxdl_sc_mng_gns_pta_req_hc_v
      UNION ALL
      Select project_id,task_id,award_id
      xxdl_sc_mng_gns_pta_inv_hc_v
      ...) x
    where a.transaction_id = x.transaction_id
    and a.source_name = x.source_name
    )or put the tuple in the where clause at the bottom

  • Can we use concatenate in where clause of a select query

    I have a select query as follows....
        SELECT ebeln ebelp belnr vgabe bwart DMBTR
                                 FROM ekbe
                                 INTO TABLE i_ekbe
                                 FOR ALL ENTRIES IN i_blck
                                 WHERE ebeln =  i_blck-ebeln AND ebelp =                                                                               
    i_blck-ebelp.
    Now i want to retrieve data from BKPF ..can i write a select query something like....
    select * from BKPF into itab
                FOR ALL ENTRIES IN i_ekbe
                where awkey = ( conatenate i_ekbe-belnr i_ekbe-gjahr )
    OR ELSE...is there any other way to link table ekbe and bseg ???

    Hi Poonam,
    SELECT ebeln ebelp belnr vgabe bwart DMBTR
    FROM ekbe
    INTO TABLE i_ekbe
    FOR ALL ENTRIES IN i_blck
    WHERE ebeln = i_blck-ebeln
    AND ebelp = i_blck-ebelp.
    select *
    from BKPF
    into  table itab
    FOR ALL ENTRIES IN i_ekbe
    where belnr = i_ekbe-belnr.
    If u want to check with AWKEY concatenate into seperate field and then use to check in where condition.
    data: lw_awkey(20) type c.
    CONCATENATE  i_ekbe-belnr  i_ekbe-gjahr  INTO lw_awkey.
    select *
    from BKPF
    into  table itab
    FOR ALL ENTRIES IN i_ekbe
    where awkey = lw_awkey
    Best regards,
    raam

  • (How) Can I use Existing Time Machine On New Mac Without Erasing Original TM Backups?

    I just got through doing a clean install from Mavericks to Yosemite and now I'm trying to attach and recognize the original Time Machine Drive (TMD)
    I chose to install as a new computer and did not choose a Time Machine backup option because the original TMD was not attached at the time of installation.
    Upon arriving at the desktop and connecting my original TMD, I was able to see it in finder but Time Machine did not automatically accept it.
    I am able to see the disk in Time Machine but it doesn't tell me that its got data on it .
    HERE'S THE ANXIOUS MOMENT:  If I select TMD, which is the original, will it overwrite all that orignal information, or will it continue adding to it?
    I've read under different parts of the forum that if you go through this process during the original setup and the Time Machine drive is attached to the computer then you will be prompted to inherit the old Time Machine. Since I didn't have the drive attached, I didn't see that.
    Now back to desktop and into the Time Machine utility:  This option to inherit doesn't seem to exist or is obvious.  The only option after selecting the drive in Time Machine  is "Use Disk".  If I click this, will it erase my original data or will it ask to inherit the drive?  It's not very clear what will happen after I click "Use Disk".
    Thanks so much to anyone who can help, Jeff

    Thanks for the link. I went there but didn't find any information on how to inherit the backup history.  The link says "If you’re replacing an old Mac and want the new Mac to use the backups from the old one, click Inherit Backup."  At what point in the migration process does it ask "to specify whether you (I) want a new Mac to inherit a backup"? It seems like I got quite a few levels into Migration assistant and the last click that I did not click seemed like it was good to start the process without telling me anything about inheriting anything.
    Any suggestions or did I not go far enough?
    From Apple Website below
    OS X Yosemite: If you want a new Mac to “inherit” your backup history
    You can move the backup history from one Mac to another, but after the new Mac “inherits” the backup history, you can’t use the backup history on the original Mac.
    You’re asked to specify whether you want a new Mac to inherit a backup if you do any of the following:
    Use Migration Assistant to transfer your settings from an old Mac to a new one.
    Use Migration Assistant to transfer your settings from a Time Machine backup of an old Mac to a new one.
    Clone the disk you use to start your Mac, or physically move it from an old Mac to a new Mac.
    Replace your computer’s main board.
    If you’re replacing an old Mac and want the new Mac to use the backups from the old one, click Inherit Backup.
    If you plan to continue to use your old Mac, click Create New Backup to preserve the backup history and start separate backups for the new Mac.
    Connect a new backup disk to your Mac 
    Transfer your info from a PC
    Last Modified: Nov 18, 2014

  • I have microsoft outlook installed on my Mac book pro, I can only use the outlook with the office server where it was setup, I can't use outlook else where, is there any way I can reset the settings in order to be able to use outlook every where?

    I have microsoft outlook installed on my Mac book pro, I can only use the outlook with the office server where it was setup, outlook won't work out of office, is there any way I can reset the settings in order to be able to use outlook every where?

    I can see my folders by clicking the X next to my name on the Inbox Folder.  So I have my folders now, just cannot see them in the left colum or see multiple windows on Outlook.  At this point, I can use the folders, just with limited functionality.  Thanks -Gina

  • Can I use existing portal to connect to multiple R3 systems  for config

    I am planning to use existing portal 6.0 to connect to multiple R/3 systems for testing and configuration.
    We have three portals in our landscape DEV TST and PRD.
    Our R/3 system landscape -->DEV, DEV2, TST,TST2,TST3 etc.
    DEV portal is connect to dev system TST portal to R/3 TST system etc.
    Is there a way I can connect DEV portal to DEV2 R/3 System without effecting portal testing and configuration which is in progresses in DEV R/3 system.
    If any one has done it in the past, please share instructions
    Thanks,
    adil

    Hi Syed,
    Check this link for creating systems.
    Configuring EP for connecting to SAP R/3
    http://help.sap.com/bp_epv260/EP_EN/documentation/EP/N03_BB_InstallGuide_EN_US.doc
    Regards
    Arun

  • Can i use existing airport with Time Capsule

    i have already bought an airport, but can i use it with Time Capsule  OR do I need to buy the $299 Time Capsule wireless hard drive?

    If you are telling us that you have already bought an AirPort Extreme, and that you want to connect a USB hard drive to the AirPort and use that for Time Machine backups, this is not officially supported by Apple.
    Some users seem to be able to make this work, while others.....like me....who try this have nothing but problems.
    To be officially supported, you need to connect a hard drive directly to your Mac for Time Machine backups or use a Time Capsule.

  • How can I use existing anchor point as a new one?

    Can anyone help?
    I'm tracing over a drawing, and I'm trying to use an existing anchor point as an anchor point for another curve. So, from c, I want to click and drag on anchor point b to make a new curve. If I click where b is, then I just delete b. Can I make b my initial anchor point so that I can use it to complete my tooth? When I get to the next teeth Ill have to do the same thing. Has anyone any ideas?

    > Each tooth should be a closed path.
    Why?
    > If I click where b is, then I just delete b.
    Ugh, turn off Auto Add/Delete Anchor Point and watch your rage levels instantly decrease. You can then put your final point anywhere you want, including smack dab on top of B.

  • Can I use EXISTS?

    Hi, I am fairly new to sql and need help with a query...
    I have two tables
    Titles
    Name.............Number
    A...................1
    B...................2
    C...................3
    D...................4
    etc
    etc
    Holders
    Number.........Colour
    1...................Blue
    2...................Red
    3...................Green
    etc
    I want to selct all from Titles where the number does not exist within holders.number. My simple query is
    Select Titles.*
    where Titles.Number = Holders.Number
    and Titles.Number not in (select Number from Holders)
    However, both table have > 50000 records and the query takes too long to run. How can I do this using NOT EXISTS?
    Thanks,
    Ian

    Your two choices would look something like this...
    Select Titles.*
    from   Titles
    where  Titles.Num_ber not in (select Num_ber
                                  from   Holders
                                  where  num_ber is not null);
    Select Titles.*
    from   Titles
    where  NOT EXISTS (select 1
                       from   holders
                       where  holders.num_ber = titles.num_ber)
    ;Run some explain plans and benchmarks to see if one is faster than the other.

  • Can I use existing 10g iAS install with Application Express?

    I apologize if this has been addressed somewhere else, but I haven't been able to find a definitive answer yet.
    I have a 10g DB installed on machine A, and have been following the instructions to install Application Express. Instead of installing another instance of HTTP_Server (from the companion CD) on machine A, I have machine B with a full 10g iAS install on it (discoverer, portal, infrastructure, etc). I would like to use machine B as the front end to access htmldb. Machine B has 2 oracle homes, one for the infrastructure and one for the BI tools/portal stuff. Which one do I configure for htmldb? From reading in this forum I think I can use the dads.conf file instead of the marvel.conf file (which doesn't exist) to add the pls/htmldb info, but I can't figure out which one to edit. I probably have something else wrong somewhere, but this would help narrow things down. Currently when I go to the following url http://machineb:7778/pls/htmldb I get "503 Service Temporarily Unavailable".
    Thanks in advance for any help.
    Rhonda

    Sure, you can use the Application Server, no need to install another one.
    You would add the configuration to the BI tools/portal stuff Oracle Home, not the infrastructure.
    You don't need the marvel.conf explicitly (but this is installed per default when you install the http server from the 10g companion CD).
    You could just add the DAD configuration to the dads.conf.
    To make it a bit simpler I would do the following:
    1) remove the entries for /pls/htmldb from your current dads.conf (if they exist).
    2) follow the instructions here: http://www.oracle.com/technology/products/database/application_express/howtos/howto_useoas10g.html
    And use the following for the contents of the file marvel.conf (make sure to change it accordingly for your environment (changes to make are bold):
    AddType text/xml xbl
    AddType text/x-component htc
    Alias /i/ /home/oracle/oracle/product/10.2.0/db/htmldb/images/
    &lt;Location /pls/htmldb>
        Order deny,allow
        PlsqlDocumentPath docs
        AllowOverride None
        PlsqlDocumentProcedure wwv_flow_file_manager.process_download
        PlsqlDatabaseConnectString localhost:1521:o1020
        PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
        PlsqlAuthenticationMode Basic
        SetHandler pls_handler
        PlsqlDocumentTablename wwv_flow_file_objects$
        PlsqlDatabaseUsername HTMLDB_PUBLIC_USER
        PlsqlDefaultPage htmldb
        PlsqlDatabasePassword &lt;password for HTMLDB_PUBLIC_USER>
        Allow from all
        PlsqlErrorStyle ModplsqlStyle
    &lt;/Location>
    ~Dietmar.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • [Solved] Pacman.log no longer logging maybe systemd

    Hi, I upgraded a couple of days ago on the 11th to systemd system, I am using 86_64 awesome DE, I ran Syu yesterday and this morning I found mplayer was acting poorly so I went to check pacman.log to see what was updated. Pacman.log hadn't logged sin

  • "Save as project" crashes 100% of the time on first save

    Hopefully this is covered somewhere but I couldnt find it. Every time I try to save a new and unsaved little scetch to my external firewire 800 GlyphQ HD (or anywhere) it allways crashes Logic after the save is done. I can then restart logic and load

  • IPhone sync with Web Gallery

    I have been sending photos, taken with my iPhone, to a .Mac Web Gallery. When I view info for a photo, it has very little information attached to to it; height, width, name, size and import date. Is there a way to make it so iPhone can attach more in

  • Power Adapter fails

    I have one of the powerchords HP wants to replace because there is a risk of it melting or catch a fire. I have had an issue with my whole adapter since this summer, the first time it overheated big time and didnt charge my laptop anymore, after a co

  • Trend micro smart keeps requesting changes...why?

    I have Trend Micro Smart Surfing on my Macbook Pro, and its been active since I bought it with the laptop in Fall 2011. Recently, it started asking me to type in my password to allow changes. It will occur randomly without a set time or specific webs