Decode for EXISTS and  NOT EXISTS conditions

Hello all,
I need to use either EXISTS or NOT EXISTS before the subquery based on the situation. I have written a test query but its erroring out. Please check it.
select 1 from dual
where DECODE('A','A',EXISTS ,NOT EXISTS)
(select ename from EMP
where ename = 'SCOTT')
Thank You
KK

DECODE will not replace part of the query. Functions don't work that way.
(It won't work if you put EXISTS and NOT EXISTS in quotes, either.)
What you want is something like
WHERE (<condition> AND EXISTS...) OR (<not-condition> AND NOT EXISTS...)You can also do:
SELECT 1
FROM dual
CROSS JOIN (SELECT COUNT(1) AS exists_fg FROM emp WHERE ename = 'SCOTT') ex
WHERE (<condition> AND exists_flag > 0) OR (<not-condition> AND exists_flag = 0)This way, you don't have to include the entire WHERE EXISTS condition twice.
-- Don

Similar Messages

  • How to add a feild as key combination for existing condition table

    Hi all,
    please any body can inform me about how to add a feild as key combination for existing condition table ex 901 having the key combination of sales organisation and material
    for this cond. table,how  to add a new feild ex:price list
    iam unable to add it in change mode of v/03.(even after removing this 901 table from Acc.seq.)
    Edited by: rajendraprasad vasam on Apr 25, 2008 10:08 AM

    mr.Rajendra
         I you have the access key - you can copy the 901 table and create a new table along with your required field. v/03
    Or
    in the access sequence for the condition type - add 1 more step and add your field.
    ie 10 - 901
    and in 20 - your required field
    regards,
    Reshmi
    Edited by: reshmi bhaskar on Apr 25, 2008 10:21 AM

  • TS1702 how can I get anyone to give us answer on the iphone apps casino game we purchased few days ago which once the token was finished we were not able to reset and play just for fun and not for gambling. we need help and not to be charged additional

    few days ago I have purchased Iphone casino games from itunes apps store. One of the game was made by the company called "ARISTOCRAT" dragan game. Usually we will get basic tokens to play the game, and if we ran out of the tokens all we need to do is going into "manu" and "setting" selete "dream" and reset that we should be able to continue play the game with same amount of the basic tokens. The one game would not let us to go back to the game. There were msg came out said" game center requires an active connection to the internet"? I didn't feel comfortable because we purchased the game for $1.99 to play for fun and not to gamble. We do have credit card on your file. We don't want to be charged alot of money for something not in our well. I need help to answer the question on the following:
    1.  Are we able to ever play this game again without going to internet? We don't even know which site to go to, because when we press the ok button nothing else came out to direct us to any area.
    2. We only purchased the few days ago order ID: MGT74GN6V7 on 10/03/12. all the other games we purchased we were able to continue to play by doing the same setting.
    Thank you for your help and looking forward to hear from you!

    You need to contact itunes support
    We are all itunes users just like you.
    http://www.apple.com/support/contact/

  • I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    Plawexki wrote:
    ...  do you know if the contacts, photos, messages etc will be wiped?
    Yes... Everything will be Wiped and Replaced with what is currently on Your Mac.
    SYNCING with iTunes
    See here  >  http://support.apple.com/kb/HT1386
    From Here  >  http://www.apple.com/support/iphone/syncing/
    You may find this information of interest...
    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • Outlook to iPhone sync failure – Sync suddenly stopped working for calendar events but continued for contacts and notes.   Finally Fixed!!!  SUPPORT TEAM – PLEASE SEE THIS – Complete explanation of cause and correction steps.

    The issue:  Outlook to iPhone sync failure – Sync suddenly stopped working for calendar events but continued for contacts and notes.   Finally Fixed!!! 
    SUPPORT TEAM – PLEASE SEE THIS – Complete explanation of cause and correction steps.
    The cause:  It is now clear what caused this problem.  For years I had several “all-day” events in my Outlook calendar (birthdays, anniversaries, etc.).  In May 2012 I decided to make some of them one hour  events so I could add alerts to remind me of the event.  I did this by dragging them in Outlook to the time I wanted and expanding them to the time slot desired and then adding the alarm.
    The symptom:  Syncing stopped working for the calendar but continued working for contacts and notes.  I didn’t realize sync was failing until months later when I missed two very important phone calls, so when I noticed it the cause was not obvious. 
    The failed attempts:  I’m head of a software firm and my calendar sync is a crucial to my business life so I took this on with a vengeance.  From a quick look at events in Outlook and the iPhone I could see that the problem started in May 2012.  Events before May were in both Outlook and the iPhone but events after May were only one or the other.  Unfortunately I had changed several other things at the same time relating to other events so again the cause was not obvious.  MANY calls with AppleCare proved them incompetent so my internal IT guys assisted trying many things.  We tried a huge number of calendar changes and several versions of iTunes, iPhone OS and Office as well as both iPhone 4 and 5, all without success.
    The fix:  After 18 months of frustration, MANY  hundreds of $ expense and MANY hours of wasted time I saw a blog that had a calendar sync  problem and it indicated all day events were related.  I changed the display of the Outlook calendar to the list view, added columns so I could see “all day” event check marks as well as times of events,  sorted on the “all day” event column to move them to the top, and for all events that were “all day” events AND had a start and end time, I removed recurrence and then added the annual recurrence back…
    After I fixed all events that had BOTH “all day” set and had a start/end time, I tried another sync.  It synced for the first time in 18 months! 
    Problem occurred May 2012 – fixed Nov 2013

    Hi, to remove dummy '_ModGrp' entries, rather than crashing the 'Suppr' key on your keyboard, you can use this basic VBA macro (launched for instance from Excel).
    It will recursively remove all '_ModGrp...' folders
    Sub RemoveFolders_Click()
        Dim oOutlook As Outlook.Application
        Set oOutlook = New Outlook.Application
        Set objNameSpace = oOutlook.GetNamespace("MAPI")
        Call CleanFolders(objNameSpace.Folders)
    End Sub
    Sub CleanFolders(objFolders As Outlook.Folders)
        For i = objFolders.Count To 1 Step -1
            If Left(objFolders(i).Name, 7) = "_ModGrp" Then
                objFolders.Remove( i )
            Else
                If Not objFolders(i).Folders Is Nothing Then
                    Call CleanFolders(objFolders(i).Folders)
                End If
            End If
        Next i
    End Sub

  • Is it possible that theseproperties are only available for files and not f

    Hello All,
    I have created few properties like ReqNo (takes Integer) and ReqDate (accepts Date). 
    I have set the above 2 properties as manadatory. Created a Group and added his goug in 'allgroups' such that I see a tab wherein I can fill in these properties.
    My questions is:
    <b>Is it possible that these properties are only available for files and not for folders</b>. The reason being that even if I create a new folder, I need to fill some values in the above two mentioned properties.
    These properties need to be mandatory and cannot make them optional.
    Please help me solve this mystery.
    Awaiting Reply.
    Thanks and Warm Regards,
    Ritu

    Hi Ritu,
    If you only want the property to be available for files and not folders you only enter data into the "Document Validity Patterns" field in the Property config.
    Regards
    Paul

  • I purchase the wrong photo shop , it was for windows and not mac and I would like to have it refunded back to my paypal account. Adobe Photoshop Elements 13

    I just purchase a photo shop and then realize it was for windows and not a mac. Here is the information from my purchase. The order was through my paypal from Valada Harp
    Adobe Photoshop Elements 13 & Adobe Premiere Elements 13 (Windows,English)
      1057-1619-6173-1547-6758-9171
      1143-1300-3153-3314-1230-901
    Please refund my money.
    Valada Harp

    Just to clarify, Valada:
    1.— This is a user forum; you are not addressing Adobe here.
    2.— You're in the wrong forum.  This is not the Elements forum.
    Here's the link to the forum you want:
    https://forums.adobe.com/community/photoshop_elements/content
    3.— Unfortunately, only Adobe customer service can assist you with your issue. These are user forums; you are not addressing Adobe here.
    Click on the link below, and after that click on "Still need Help? Contact us."
    Then on the next page, click Chat
    There is also a phone option.
    http://helpx.adobe.com/contact.html?step=PHXS_downloading-installing-setting-up_licensing- activation

  • Blackberry turn off for reboot and not getting started....

    Blackberry turn off for reboot and not getting started.... what can  I do ? thank you

    Hey peselvam,
    Welcome to the BlackBerry Support Community Forums.
    I would suggest to do a clean reload of the device software as shown here: http://btsc.webapps.blackberry.com/btsc/KB11320, please test before restoring any backup data to the device.
    I hope this helps.
    -HB
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Which photoshop is for beginners and not the costly full version?

    which photoshop is for beginners and not the costly full version?

    Depending on what you want to achieve, there is also Lightroom 4.
    When comparing CS6, Lightroom, and Elements, Adobe says:
    Q:  How do Adobe Photoshop, Photoshop Extended, Photoshop Elements, and Photoshop Lightroom software differ?
    A:  Photoshop Elements 11 (US$99) is designed for people who are just getting started with digital photo editing, and delivers powerful yet easy-to-use options that help you organize, edit, create, share, and help protect your personal photos.
    Photoshop CS6 (US$699) is the professional standard for creating and manipulating powerful images, and Photoshop CS6 Extended (US$999) delivers everything in Photoshop plus tools for creating and editing 3D images and objects.
    Photoshop Lightroom 4 (US$149) addresses the workflow needs of professional and serious amateur photographers, enabling them to import, process, organize, and showcase large volumes of digital photographs quickly, or develop a single image.
    And they also have a page that neatly summarizes the best uses for each product. This article gets even deeper into the comparison. I hope this is helpful!

  • HT1918 can I just use gift cards for itunes and not put a credit card on my account

    can I just use gift cards for itunes and not put a credit card on my account

    Welcome to the Apple Support Communities
    You can do that without any problem. That's what some people do to purchase content from the iTunes Store, App Store or iBookstore

  • WHY FREE ITUNES PRODUCTS ARE AVAILABLE ONLY FOR USA AND NOT FOR OTHER USERS OUTSIDE USA

    I am so impressed wit the welcome page saying "Join the conversation. Share tips and solutions with fellow Apple product users from all around the world."
    Apple mentioned for their products users around the world but many of their free itunes products are available only for USA and not for the users from the other side of the globe?
    Is this Apple a fair and customer oriented company or full of bias and Only money oriented company.
    If apple could not make thier other FREE stuffs available outside US territory then better for thsi company to just sell their products in USA. its just so disgusting...  If we need a certain apps (FREE APPS) available only for US based users.
    If you think US users and other country users are paying the same prices for their iPad 3G/4G WIFI 64GB and iPhone 3G/4G 64 GB like hat I did having the 2 gadgets altogether but my investment ends to disgusting as the apple company cound not treat people equal then.....  I want to return all this **** stuffs

    iTunes for Different Countries
    iTunes Store: Which types of items can I buy in my country?

  • Which is better for school and notes pages or ms word

    Hi have a macbook white and i bring this to school and i want to know which is better to use ms word or pages for notes and school work

    If you have used Windows for years and Microsoft Office, then Word will work much better because you will learn to use it quicker than Pages. However, Pages is much cheaper than Microsoft Word, and if you don't mind learning a new interface, then Pages should be enough.
    I use Pages for school projects, and there's one thing that makes a difference: create equations. Pages requires a third-party application like MathType and Word has got a built-in editor, so you should consider this

  • Apple keeps asking for password and not recognising it

    Apple keeps asking for my password and not recognising it.  Can't use facetime at all.  Everything else works. Please help.

    Just what are you doing when it asks? What is asking for the password?
    DId you reset the password?

  • APO DP - use of tables for selections and notes

    I am using APO DP V5.
    I note that tables for holding selections and notes are planning area specific and have tables names such as /1APO/S1nnnnnnnn and /1APO/F1nnnnnnnn respectively.
    My questions:
    1. What is the logic for the naming of these tables
    2. For a given planning area, are the tables names the same as one moves from Development to QA to Production environments
    Thanks,
    Bob Austin

    Bob
    I think the answer for the notes part of this question is here. The logic for the selections should be the same
    Re: Updating of Notes for cells in APO DP
    The table names might not be the same in QA since they are created independently and dynamically. But one way to check is to try it out

Maybe you are looking for

  • Comm Channel Variable Substitution - Use of wildcards to reference payload

    Hi! I am building a solution to write out tagged / XML IDOCs to a file adapter. I am using variable substitution to build the file name to include the message type, sending partner etc... in the target directory and filename. Is there a way to wildca

  • How many logical systems are required to connect between one XI and R3 sytm

    Hi Experts,                I need to know how many Logical systems we need to create when connecting an SAP XI and SAP R3 system. details wht I configured is as follows : For XI :  LOGSYSXI assigned to 100 client For R3:  LOGSYSR3 assigned to 800 cli

  • Payment due date in billing

    Hi, We want the system to pick the date of next working day if the payment due date is falling on non working day during billing. There is a functional module 'DATE_CONVERT_TO_FACTORYDATE' available. I donu2019t know where to use this FM so that it c

  • How to run windows dll files and driver loaded in remote system?

    Dear Friends, I need some valuable info regd how to run a remote windows dll files and the drivers of the system using java reply regd thanking you

  • Export results to different file type

    I am very curious, if you can successfully export to csv format when choosing for query result in sql dev 2.1. 1. Worksheet 2. Enter a Query 3. Press the first green arrow to perform the query 4. Navigate to the results with the mouse and right click