Problem with the case where the clause

Hello

I want to use cases in which clause. I wrote a very simple query to test how it works. However, I always got an error message. Here's what I did.

Select eid, firstname, lastname from employee where eid = 1 works fine

Select eid, name, name of the employee

where

cases where 1 = 1 then eid = 1

When 1! = 1 then eid = 2

end

I ORA-00905: lack of keyword.

Did I miss something?

Thank you

Jennifer

Hi, Jennifer.

Why do you want to use BOX in a WHERE clause?  The wonderful thing about the CASE is that it allows you to do IF-THEN-ELSE logic.  In a SELECT clause, or an ORDER BY clause, this is really useful, but the WHERE clause already allows you to use the IF-THEN-ELSE logic.

However, if you use the BOX in a WHERE clause, it is as it does nowhere else.  Always BARGAIN instead of a single expression in a SQL data types.  All the clauses THEN (and ELSE, if there is one) must return a single expression, such as the NUMBER.  (There is no BOOLEAN data type in SQL).  So, you can use a CASE statement like this:

...

CASES WHERE

WHEN 1 = 1 THEN 1

WHEN 1! = 1 THEN 2

END = eid

Here, the CASE expression takes the place of a NUMBER.

However, if I was not sure if 1 = 1 or not, I would write the condition in this way, without a CASE expression:

WHERE (1 = 1 AND eid = 1)

OR (1! = 1 AND eid = 2).

Tags: Database

Similar Questions

  • Problem with the clause.

    I use WITH clause in one of my request... and instead to choose the table WITH I use for INSERTING records... I can do this...
    I write the quesry below and the error message... Will be great if someone can give an idea...


    WITH GADGET_MAP AS (SELECT UCP_AWU_PK, PRD_AME_PK FROM FSI_AT_USER_COUNTRY_MAPPING, FSI_AW_PROFILE_DETAILS WHERE UCP_PRF_PK = PRD_PRF_PK AND PRD_AME_PK IN (SELECT AME_PK FROM FSI_AW_MENU WHERE AME_GADGET_TYPE IS NOT NULL) LESS SELECT UGM_AWU_PK, UGM_AME_PK FROM FSI_AW_USER_GADGET_MAPPING) INSERT INTO FSI_AW_USER_GADGET_MAPPING (UGM_PK (, UGM_AWU_PK, UGM_AME_PK, UGM_GADGET_HEIGHT, UGM_GADGET_COL_ID, UGM_GADGET_ROW_ID, UGM_GADGET_MAX_ITEMS, UGM_GADGET_ANIMATION, UGM_GADGET_RELOAD_MIN, UGM_MIN_MAX_CLOSE, UGM_GADGET_TITLE, UGM_GADGET_FORM_VALUES, UGM_GADGET_DB_FILTER, UGM_GADGET_TITLE_KEY, UGM_GADGET_CREATED_BY, UGM_DELETE_ALLOWED, UGM_SHOW_MOBILE, UGM_IS_ACTIVE, UGM_MOB_SEQ, UGM_GADGET_GRAPH_TYPE) SELECT UGM_PK_SEQUENCE. NEXTVAL, UCP_AWU_PK, PRD_AME_PK, AME_GADGET_HEIGHT, AME_GADGET_COL_ID, AME_GADGET_ROW_ID, AME_GADGET_MAX_ITEMS, AME_GADGET_ANIMATION, AME_GADGET_RELOAD_MIN, 'X', AME_NAME, AME_GADGET_FORM_VALUES, AME_GADGET_DB_FILTER, AME_RESOURCE_KEY, 1, "N", "N", AME_IS_ACTIVE, AME_GADGET_MOB_SEQ, NULL FROM FSI_AW_MENU, GADGET_MAP WHERE AME_PK = PRD_AME_PK;

    Error: -.
    ERROR on line 1:
    ORA-00928: lack of SELECT keyword

    Thanks in advance...

    You must reformat the query.

    INSERT INTO FSI_AW_USER_GADGET_MAPPING
     (UGM_PK ,UGM_AWU_PK ,UGM_AME_PK ,UGM_GADGET_HEIGHT ,UGM_GADGET_COL_ID ,UGM_GADGET_ROW_ID ,UGM_GADGET_MAX_ITEMS ,UGM_GADGET_ANIMATION ,UGM_GADGET_RELOAD_MIN ,UGM_MIN_MAX_CLOSE ,UGM_GADGET_TITLE ,UGM_GADGET_FORM_VALUES ,UGM_GADGET_DB_FILTER ,UGM_GADGET_TITLE_KEY ,UGM_GADGET_CREATED_BY ,UGM_DELETE_ALLOWED ,UGM_SHOW_MOBILE ,UGM_IS_ACTIVE ,UGM_MOB_SEQ ,UGM_GADGET_GRAPH_TYPE )
    (
    SELECT UGM_PK_SEQUENCE.NEXTVAL, UCP_AWU_PK, PRD_AME_PK ,AME_GADGET_HEIGHT ,AME_GADGET_COL_ID ,AME_GADGET_ROW_ID ,AME_GADGET_MAX_ITEMS ,AME_GADGET_ANIMATION ,AME_GADGET_RELOAD_MIN ,'X' ,AME_NAME , AME_GADGET_FORM_VALUES , AME_GADGET_DB_FILTER , AME_RESOURCE_KEY ,1 ,'N' ,'N' ,AME_IS_ACTIVE , AME_GADGET_MOB_SEQ ,NULL
    FROM FSI_AW_MENU ,
    (SELECT UCP_AWU_PK, PRD_AME_PK FROM FSI_AT_USER_COUNTRY_MAPPING , FSI_AW_PROFILE_DETAILS WHERE UCP_PRF_PK = PRD_PRF_PK AND PRD_AME_PK IN
    (SELECT AME_PK FROM FSI_AW_MENU WHERE AME_GADGET_TYPE IS NOT NULL) MINUS
    SELECT UGM_AWU_PK,UGM_AME_PK FROM FSI_AW_USER_GADGET_MAPPING )  GADGET_MAP
    GADGET_MAP WHERE AME_PK = PRD_AME_PK
    );
    
  • Have a problem with the Windows XP where he did not finish the boot.

    Have a problem with the Windows XP where he did not finish the boot. Ran remote console and @ the c: > guest tried to run chkdsk/r/p and received the error message "invaild drive. I put the drive in the argument?

    Hello Tmagic,

    Thank you for your message.  The correct format is below:
    chkdsk volume: (switches, e.g./r/p)

    example: chkdsk c: /r /p

    If these results find but cannot fix all the mistakes, you can also check with the manufacturer of your drive and possibly download a utility that will check the errors and repairs.
    Please let us know if it did or did not help to solve your problem.
    See you soon

    Engineer Jason Microsoft Support answers visit our Microsoft answers feedback Forum and let us know what you think.

  • Change hard drives where the files stored, how to ensure that no problems with the catalogue

    I replaced the 3 TB drive (and readers of backup related) who hold all the image files on my Mac Pro with a 5 TB drive.

    The player has only the image on her files. The catalog and previews remain in the folder of images on my main system drive.  I formatted the new drive in an external hard drive enclosure, then used Super Duper to copy the image of the old 3 TB HD files to new hard disk 5 TB. Now, I'm ready to install the new HD 5 to in the computer and the catalog of links to it, but want to make sure you do it correctly.

    This player has 81 000 image files, catalogued in 15 "buckets", each "bucket" with about 15 cases of work, so I obviously want to make sure that I don't have to tie all these files by hand.

    What is the best method to do this, so I have no problem with the catalog know the new location of the files?

    Mac OSX 10.10.5

    Lightroom CC 2015.1

    Thank you!!

    This player has 81 000 image files, catalogued in 15 "buckets", each "bucket" with about 15 cases of work, so I obviously want to make sure that I don't have to tie all these files by hand.

    What is the best method to do this, so I have no problem with the catalog know the new location of the files?

    Instructions are here: Adobe Lightroom - find folders and files moved or missing connect the parent (as shown in Figure 4) folder, and then all subfolders will be also connected. If I understand your use of the word 'bucket' (do you really mean "parent folder"?), then you will need to do this for each of the 15 buckets.

    It would be much easier if you had a 'bucket' or parent folder and many subfolders and sub-sub-folders.

  • How do I monitor/find where is the State of my download?  I don't know how long it takes or if there is a problem with the download that I can't find anything.  Also, is it supposed to be an icon for my purchase of Photoshop and light in my apps folder

    How do I monitor/find where is the State of my download?  I don't know how long it takes or if there is a problem with the download that I can't find anything.  Also, is it supposed to be an icon for my purchase of Photoshop and light in my apps folder?  Where can I find that when it's done download?

    Could you please confirm the operating system you are using.

    You can see the status of the application of CC desktop download.

    The CC app desktop click the creative cloud icon located in the taskbar (Windows) or the Apple bar (Mac OS) menu, to open the creative cloud desktop application.

    Hope this will help you.

    Kind regards

    Hervé Khare

  • Hi, I had problems with the addition of soundtrack to Adobe premiere elements 13. When I add it or drag it immediately comes crashing windows, where says "Adobe Premiere Elements has stopped working". I can add videos with no problems, but cannot add any

    Hi, I had problems with the addition of soundtrack to Adobe premiere elements 13. When I add or drag it happens immediately windows crash, where says "Adobe Premiere Elements has stopped working". I can add videos with no problems, but cannot add .mp3 files.

    I had Windows 8.1, 2.4 GHz, 6 GB of RAM. How to solve this problem?

    Fixed a problem when converting the mp3 file. WAV...

    some poor Adobe Premiere Elements if there is for example simple bug in the software.  Waste of money for this software.

  • I encountered the problem with the last iOS 9.3.2 update I can't receive call from people, I can call any body, but when l'm calling people any body can ring me just now, I thing the problem where new soft

    I encountered the problem with the last iOS 9.3.2 update I can't receive call from people, but I can call any body, but when l called people any body can ring me only at this time, I think that the problem of the new update. can u check this and answer my question.

    and my phone

    iPhone 6plus

    You see a Crescent Moon at the top of the screen icon? If Yes, disable does not bother to: settings - do not disturb = Off.

  • problem with the CURSOR and WITH clause

    Hi guys,.

    I have never created a package before. I try to run it, but I get:
    ORA-06550: line 8, column 16:
    PLS-00382: expression is of the wrong type
    ORA-06550: line 8, column 3:
    PL/SQL: Statement ignored

    I know that my problem is in the next section

    OPEN FOR V_io_cursor

    with GOT_R_NUM like)


    Is the above correct?

    When I copy paste the "heart" of the query, it works very well. I really have a problem with the CURSOR and the declaration.

    Here's the code in its entirety. I know that the code is much more then he returned, but ignore this overload that was to do some tests to make sure that I can achieve any query request.

    CREATE OR REPLACE
    PKG_SPF_NATIONALREPORTS PACKAGE BODY IS

    PROCEDURE GET_NATIONAL_TOTAL_RESULTS (P_SelectFields IN varchar2, P_SUMFields IN varchar2, io_cursor IN OUT C_RESULTS)
    IS
    v_io_cursor C_RESULTS;

    BEGIN

    OPEN FOR V_io_cursor

    with GOT_R_NUM like)
    SELECT
    -START P_SelectFields
    r.cli_served,
    r.EIER,
    -END P_SelectFields
    r.RC,
    r.Year_ID,
    r.period_id,
    r.agreement_type_ind,
    CONTRACT_NUMBER. CONTRACT_NUMBER_TEXT,
    YEARS.year_desc,
    RC_CODE.rc_code_id,
    RC_CODE.rc_code,
    AHRDA HOLDERS. AHRDA_ID,
    AHRDA HOLDERS. REGION_ID,
    AHRDA HOLDERS. PROVINCE_ID,
    AGREEMENT_TYPE. AGREEMENT_TYPE_ID,
    AGREEMENT_TYPE. AGREEMENT_TYPE_DESC_EN,
    ROW_NUMBER() over (partition R.YEAR_ID, R.CONTRACT_Number_Text
    order by
    P.PERIOD_desc
    (/ / DESC NULLS LAST) AS r_num
    RESULT r
    JOIN period p ON r.period_id = p.period_id
    JOIN CONTRACT_NUMBER ON r.contract_number_text = CONTRACT_NUMBER. CONTRACT_NUMBER_TEXT
    JOIN RC_CODE ON contract_number.rc_code_id = rc_code.rc_code_id
    JOIN AHRDA holders ON ahrda.ahrda_id = rc_code.ahrda_id
    JOIN AGREEMENT_TYPE WE AHRDAS. AGREEMENT_TYPE_ID = AGREEMENT_TYPE. AGREEMENT_TYPE_id
    JOIN the YEARS WE r.year_id = YEARS.year_id
    )
    SELECT year_desc
    -START P_SUMFields
    SUM (cli_served) AS sum_cli_served
    The SUM (eier) AS sum_eier
    -END P_SUMFields
    OF got_r_num
    GROUP BY year_desc
    ORDER BY year_desc
    ;

    io_cursor: = v_io_cursor;

    END GET_NATIONAL_TOTAL_RESULTS;

    Agree - all this talk of loops FOR is completely irrelvant.
    A refcursor is usually the exact mechanism to return a result set.

    What is C_RESULTS?

    Just use SYS_REFCURSOR.

    No need for local variable.

    OUT why? Not just walk OUT?

    PROCEDURE GET_NATIONAL_TOTAL_RESULTS
    (P_SelectFields IN varchar2, P_SUMFields IN varchar2, io_cursor OUT SYS_REFCURSOR)
    IS
    BEGIN
     OPEN io_cursor FOR ...
    END;
    
  • Qosmio G20 error message: problem with the cooling system has been detected

    I'm trying to fix a Qosmio G20 (which is about 3 years old, it is no longer in warranty).

    Error message: Warning: a problem with the cooling system has been detected.

    I managed to remove the outer case and observe the operation of the machine, and basically one of the fans does not at all. The fan which is closest to the power connector seems to work very well (he seems to be turning a lot, do not know if this is normal), but the other fan who does not seem to move at all.

    When I put in place the case and on the machine, I noticed after a few minutes the vent of the fan working heat sink had warm enough, while led the non-working fan remained cool.

    I cleaned the fan from dust and have also changed the BIOS battery mode mode high performance, but the problem still exists.

    I would be grateful if someone could give advice if the problem is the fan or something else.

    If the fan is the problem, where I can buy a: i live in the United Kingdom?

    Hello

    I think there might be something wrong with the cooling module and the replacement would be necessary.
    Usually, this should be done by an authorized provider (ASP) in your country.

    Technicians could replace it with a new part and also could renew the thermal grease which is placed between the module and the CPU cooling.

    So contact the ASP in your country and ask for later handling.

    By the way; also, you can buy the cooling of the ASP module!

    Good luck

  • Satellite A660 - 07P problem with the pointer of the mouse using the touchpad

    I just bought my A660 07P last Thursday, September 15, 10 and I noticed that I had problems with the mouse pointer using the touchpad.

    From time to time, the cursor/pointer is locked and seems something like a button up and down.
    I assume it's because it's on a mode of waiting, but in this case as every 5 minutes.
    When it is locked, it will also change the zoom percentage when the touchpad is struck. It is very not when I'm in the middle of something and I can not move the pointer. In addition, the start is very slow.

    BTW, I have not installed any programs or applications. I'm still testing until Friday, otherwise I'll go back to where I bought it.

    Hi mate

    This isn't touchpad problem.
    I guess as support for computer laptop MULTI-TOUCH PAD
    There are a few additional features supported by touchpad, and I think that you have enabled this while using the touchpad

    The touchpad supports the features:
    _ChiralMotion_
    You can scroll vertically and horizontally

    _Pinch Zoom_
    This feature provides functionality like the scroll wheel zooming

    _Rotating (chiral spin) _
    This provides gestures to rotate the photos and other objects

    _Momentum_
    This feature provides a smooth, fast trackball as the movement of the mouse. A quick finger on the touchpad surface can move the sliders in the entire screen.

  • Problem with the change in value of listbox event

    Hello

    I have a problem with the help of Listbox value change event. The code that I have attached is a simplified version of the largest program, but the problem is the same. One of the loops of Nonna is responsible for handlig occurring events ant the other is responsible for the execution of the program. In the project of oryginal I use a listbox control to determine which plots graphic display of a waveform is visible (first position of the listbox-> only plot first visible etc.). In the attached vi, I just show the current value of the listbox control. The problem is the event runs only once and then the program crashes. I want to be able to change the value of the listbox work both at idle and in State of a program, but when I put the structure of the event in both States, he does not. I'd be very grateful if someone smarter than me could tell me where I made my mistake. I want my program to be able to manage the keys and listbox events in States (slow down and knit) program.

    You have two structures of event in two cases different from the structure of the case, and both are tuned to listbox events has changed. Because only once can be triggered at any time, the VI crashes (lock events the front panel (default) until the event can complement).

    You must use a unique event structure managing all events.

    The overall program architecture looks like inside-out for me.

    For the buttosn, you must use action lock (switch not release!) and use the value changed events.

  • HP 15-d059sr: the problem with the display of graphics in games

    Good afternoon!
    Watching such a problem.
    During work on the desktop (surfing on the Internet, work with documents, see the video online, film) is OK, but it is necessary to enter the game (Stalker, Diablo 3, etc.) begins to shake up the top of the screen, or play with the brakes. Even if the settings on display at the minimum system requirements.
    And in the case of Diablo 3 for a long time so it does not display during playback load of background music.
    Core i5 12 GB of RAM, all the drivers downloaded from the official website, including the video card.

    Hi @GuardianStation,
     
    Thank you for visiting the HP Forums! A place where you can find solutions for your problems with the help of the community!

    I stumbled upon your post on the laptop and wanted to help you! I looked in your question about your laptop 15-d059sr HP computer and issues with the games. On gaming sites, it is suggested that it might be an update that is necessary with Java. Here, it is a link that you can check with.

    You can try to use the Windows Update Troubleshooter to fix updates that do not come through Windows 10.  Please restart the laptop twice to make sure that all updates are completed!

    If you downgraded to the original version of Windows, this could be the cause. I recommend to restore the default BIOS settings. You could restore the BIOS with this document by selecting the reload the default BIOS settings. In this way, it will look at the hardware installed on your laptop.

    Please let me know how it goes.

    Thank you.

  • OfficeJet Pro 6830: there is a problem with the printhead - estimate of repair costs?

    Getting the message "There is a problem with the printhead".  Found the document tracking and troubleshooting got to step 3 where it says "the printer to Service."

    Naturally, when I checked, I found that our guarantee missed three weeks ago.  The printer lasted more than a year...

    No idea what it would cost for this repair?

    Or given the pricing model for ink jet printers, are we better off he throw?

    We had an Epson printer that has lasted several years; Maybe we should go back to them?

    Hello

    Try to contact the HP Support by filling out the form below, you will receive a case number and the details of the phone:

    Note: Changing the country click and select your region as required

    https://support.HP.com/us-en/contact-HP/product/HP-OfficeJet-Pro-6830-e-all-in-one-printer-series/5390307/model/5390308

    Be sure to have proof of purchase available to provide the necessary technical support representative.

    In my opinion, that they might be able to help without charge if shortly after the end of your warranty period (even though I'm the head of my experience, not on behalf of HP).

    Do it as soon as possible and let me know how it goes.

    Shlomi

  • Cannot install Vista service pack 2 is 800f0a09 error code with the message that there are problems with the driver for dell latitude

    Original title: why I get error code 800f0a09 to upgrade to windows vista service pack 2

    I have a laptop del that is running on Windows Vista Edition Home Premium. I tried to download itunes but it requires service pack 2. Whenever I try to update to service pack 2, I get the message following error code 800F0A09. He also mentioned problems with the driver for dell latitude. What can I do to fix this please.

    Thank you

    Hello

    Please join Microsoft Community where you can find the necessary information on Microsoft products!

    You can not install Vista Service pack 2 and get the error with code 800f0a09 and the message that there are problems with the driver for dell latitude.

    The problem may occur if some of the components of the update are corrupt.

    What is the full error message that you receive?

    I suggest you follow the steps mentioned below to check if the problem is with the update components:

    Method 1: Reset the update components

    See the site:

    How to reset the Windows Update components?

    http://support.Microsoft.com/kb/971058

    Warning: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-the-registry

    Method 2: Run the system update readiness tool

     

    See the site:

    System update scan tool corrects errors of Windows Update in Windows 8, Windows 7, Windows Vista, Windows Server 2008 R2 and Windows Server 2008

    http://support.Microsoft.com/kb/947821

    Method 3: Turn off the antivirus software

     

    See the site:

    Disable the anti-virus software

    http://Windows.Microsoft.com/en-in/Windows-Vista/disable-antivirus-software

    Important note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

    I hope this helps. If the problem persists, let know us and we would be happy to help you.

  • Blue screen on startup... problem with the display driver?

    I have been using a Dell Inspiron 14R (N4110) laptop computer since 2010 without any problem.

    The laptop was purchased online from Dell and came with

    (1) Windows 7 Home Premium 64-bit and

    2) AMD Radeon HD 6470 M - 1 GB display card.

    Recently, I had a problem where my laptop just wouldn't start, showing the blue screen every time it tries to start. The blue screen mentions a problem with the file atikmpag.sys I understand is the driver for the AMD video card.

    If I delete/rename the files atikmpag.sys and atikmdag.sys (via secure boot mode) in C:/windows/system32/drivers, the laptop (not) start, but obviously does not recognize the graphics card.

    After a lot of unsuccessful trials debugging on mine (including trying to upgrade the drivers to display etc.)., I reinstalled the operating system and the drivers provided with the original kit (just to eliminate any possibility of an upgrade that went wrong). However, I still see the issue.

    That means there is a hardware problem? or a BIOS problem?

    Thank you

    R.B.

    Guys, the problem you describe is actually a hardware failure. There is nothing you can do except replace a motherboard for laptop, or taken some advanced technicians, COMPUTING which will replace or chip GPU reball.

    I have the same a laptop similar (Inspiron N5110), with the same problems and these problems - all started yesterday. Do not waste your time, just reinstall OS, then install display drivers, which are available on the official site of Support of DELL and after that - if it's not working, just do what I said.

    Generally these are consequences of an overheating laptop, but that it was certainly not my case (I did regular checks), I could even bet on chips quality GPU, which has been used in the manufacture of this model of laptop... again...

    UPDATE: Okay, last night was a long night for me and I can confirm finally - who's * chip AMD, which causes the blue screen, you mentioned. I disassembled my N5110 faulty, armed with a heatgun, Probe temperature (probe) and tons of aluminium + some flow of brazing, I made a fairly quick reflow and the result is just what I expected - everything works perfectly again, with the same configuration - even with the same installation of Windows, which has been to launch these blue screens. There are now no blue screen at all and portable computer performance as new.

    Apparently bad welding, when this laptop was manufactured, is the exact reason why we are where we are. The BGA chip was not dead at all (it was just poorly soldered). The same story, including HP and a bunch of other companies had some time ago with these NVIDIA chips (I know, some of you know what I'm talking about).

    CONCLUSION: Integrated DELL diagnostic software is useless against the detection of defects with a discreet graphics AMD card. Problem was not in the software or drivers - it was just a poorly welded chip (I regularly cleaned my laptop dust, so overheating is not an option here).

  • Problems with the Row_Number function

    I have problems with the Row_Number function. I use to assign line numbers to records where a student has a note of passage on a module and the exclusion of the modules failed (I want to show her a 0 as the line number for the modules failed). The problem is that when I try to use a condition, the report still assigns a line number to a defective module if it does not display it (it shows a 0 I wanted to show him). The results are displayed as follows:

    Line number Module Grade
    1ModuleAPass
    2ModuleBPass
    0ModuleCIn case of failure
    4 (instead of 3)ModuleDPass

    How can I make him jump to assign a line number to all the modules failed? Please help.

    Thank you.

    Thank you very much, Melanie. I made changes to query as per your suggestion, which is a union of the modules failed and passed (using row_number on success modules). Thanks for the solution.

Maybe you are looking for