SQL CASE Expression, ELSE  run "ALL"

Posted on 2007-10-02
Last Modified: 2010-08-05
I am using the following  case expression in an Oracble/PeopleSoft database:
WHEN 'bbbbb' THEN B. DEPTID in ('50000','11100','22200','333300)
WHEN 'aaaaa' THEN B. DEPTID in ('41111', 77700, "99900)
else 0
How would I change the else to ELSE run all departments.  (:1 is a prompt that indicates a userID).  When the UserId is not either 'aaaaa' or 'bbbbb', I need the query to run all departments  Note:  without the CASE expression, the query runs all departments.  
Question by:syhctl
    LVL 142

    Accepted Solution

    CASE :1
    WHEN 'bbbbb' THEN B. DEPTID in ('50000','11100','22200','333300)
    WHEN 'aaaaa' THEN B. DEPTID in ('41111', 77700, "99900)
    else 1=1

    Author Comment

    Thanks - that was probably a stupid question, but sometimes the brain just ain't functioning.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and theā€¦
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
    This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now