Reg: CASE vs. IF ELSE

All,

In the Sub function, I used IF and on the OTHER, the same is also possible in CASE. Could tell me which is more better to use and what might be the global differences. And any other suggestions please also welcome.

/ * Formatted on 2013/07/25 10:23 (trainer more v4.8.8) * /.
FUNCTION check_pickupdate (p_date VARCHAR2)
RETURN VARCHAR2
IS
v_ok VARCHAR2 (10);
BEGIN
IF TO_DATE (p_date, "dd/mm/yyyy") < TRUNC (SYSDATE) + 3
THEN
-dbms_output.put_line (' you can only book a count "| to_char (trunc (sysdate) + 3, 'day') |) ", please see the table below"); "."
v_ok: = 'NO ';
ON THE OTHER
BEGIN
IF To_char (SYSDATE, 'DY') = 'MON' - BOX WHEN
THEN
IF TO_CHAR (SYSDATE, "hh24") < '13'
AND TO_DATE (p_date, ' dd/mm/yyyy') > = TRUNC (SYSDATE) + 3
THEN
v_ok: = "OK";
ELSIF TO_CHAR (SYSDATE, "hh24") > "13"
AND TO_DATE (p_date, ' dd/mm/yyyy') > = TRUNC (SYSDATE) + 4
THEN
v_ok: = "OK";
ON THE OTHER
v_ok: = 'NO ';
END IF;
-code
-for all other weeks too
-code
ELSIF TO_CHAR (SYSDATE, 'DY') = 'SAM '.
AND TO_DATE (p_date, ' dd/mm/yyyy') > = TRUNC (SYSDATE) + 5
THEN
v_ok: = "OK";
ON THE OTHER
IF TO_CHAR (SYSDATE, "hh24") > "13"
AND TO_DATE (p_date, ' dd/mm/yyyy') > = TRUNC (SYSDATE) + 4
THEN
v_ok: = "OK";
ON THE OTHER
v_ok: = 'NO ';
END IF;
END IF; --FIN CAS ;
END;
END IF;

RETURN v_ok;
END;

Thank you

IF the instruction is supported only in PL/SQL in contrast CASE statement is supported by SQL and PL/SQL. Not to mention that his choice about. See this

declare

l_val integer: = 1;

Start

case l_val

When 1 then

dbms_output.put_line('1');

When 2 then

dbms_output.put_line('2');

on the other

dbms_output.put_line('3');

end case;

If l_val = 1 then

dbms_output.put_line('1');

elsif l_val = 2 then

dbms_output.put_line('2');

on the other

dbms_output.put_line('3');

end if;

end;

Both give the same result but it's just what you prefer and what you find, it's more elegant.

This question also came a lot of time here

Tags: Database

Similar Questions

  • REG: CASE WHEN IN WHERE WOULD ADOPT

    Hi friends, this is my query SELECT DISTINCT FILE_DIRECTION FROM RA_PROCESS_ID_MAP WHERE FILE_DIRECTION = (CASE WHEN "TAP" = "TAP" and (FILE_DIRECTION = 'A' AND FILE_DIRECTION = 'TI'), THEN WHEN 'NRTRDE"THEN FILE_DIRECTION =" NEITHER "WHEN 'SWITCH' AND FILE_DIRECTION = 'SO' END) = 1; its me given expression error... Please help.

    If this is what he wants, then it is probably more clear to remove the CASE statement total:

    Select distinct file_direction

    of ra_process_id_map

    where (: b1 = 'TAP' and file_direction in ('TO', 'TI'))

    or (: b1 = "NRTRDE' and file_direction = 'NOR')

    or (: b1 = 'SWITCH' and file_direction = 'IF')

    I think the just CASE statement confuses the issues and has clearly confused the heck out of the op.

  • Reg: Case Stmt

    Hi Experts,

    I implemented a stmt case to load data from a table to another table (the two tables are same pattern only).

    My source as table spec

    Select * from EMP

    Sal jdate empid EmpName
    Emp1 100 1000 2012
    Emp1 101 5000 2012

    even my table target spec also even called as emp1:


    my code is



    Insert into EMP1
    (
    EMPNAME,
    EMPID,
    SAL,
    JDATE

    )

    Select
    EMPNAME,
    EMPID,
    SAL,
    JDATE

    DE)


    Select
    EMPNAME,
    EMPID,
    SAL,
    EMPNAME CASE
    WHEN 'EMP' THEN TO_DATE (C4_JDATE, 'YYYY')
    WHEN 'EMP1' THEN TO_DATE(C4_JDATE,'dd-mon-yyyy')
    WHEN 'EMP2' THEN TO_DATE(C4_JDATE,'mm/dd/yyyy')
    end JDATE
    from EMP
    where (1 = 1)



    This query above works fine, but when the time to display the basic data in emp1 as of data

    JDate as: July 01, 2012

    data remaining is fine.


    Have that I need to change the date format of database to jdate disaplay as 2012 (yyyy)...

    Please suggest me where I need to change...


    Thank you
    H







    )

    Oracle date formats needs to be in a year, month, day, and hour of the elements. If update us or insert a value into a date column that does not have some of these Oracle components using the default values.

    Thus, if provide us everything a year that oracle will generate a date which is midnight the first day of the current month. It's what you do, and is why you currently values JDATE July 1, 2012. If you run your code on Wednesday you will find the JDATEs will be August 1, 2012.

    Cheers, APC

  • HP LaserJet M2727 MFP Series PCL 6 - prints the blank page before and after each document in all cases

    HP LaserJet M2727 MFP Series PCL 6
    prints blank page before and after each document in all cases
    Does anyone else have this problem.

    It must be a preference setting, but I watched three times and CAP does not seem to determine what setting to change.

    See if they help you:

    http://h20000.www2.HP.com/bizsupport/TechSupport/document.jsp?lang=en&cc=us&ObjectID=c01477176&prodTypeId=18972&prodSeriesId=3377075

    http://h30499.www3.HP.com/T5/printers-LaserJet/LaserJet-M2727-NF-can-I-suppress-blank-pages-with-this-printer/TD-p/2359555

    http://superuser.com/questions/315522/computer-prints-blank-pages-before-and-after-content

  • Clipboard keeps emptying in case of browser - inability to paste - due to malware

    Recently, I experienced an annoying problem in Windows Vista. The sharing solution.

    I noticed two things recently when browsing the Internet. The first was a few unwanted pop-ups that appeared to answer what I was browsing in time or even typing on a Web site.

    The second trouble seemed to happen to at about the same time, the pop-ups began. It's my Clipboard would be empty when erratic in my browser. This has happened with different browsers as well. I copy something from a Web site or a Word and go to paste it into a form on another site. If I pressed the transport back in the form before copying or switching to another page first, the Clipboard would be empty and there is nothing to paste.

    I ran Spybot S & D and discovered a series of malicious software which I removed. He fixed both problems. It did not fall under the Security Essentials because it is not a virus. Sorry, I made a note of the name of the villain.

    Just display in the case when someone else is going through this inability to stick.

    Hello

    Thanks for letting us share the resolution of the issue. It will allow other clients who are faced with the similar question. Feel free to ask questions in the Microsoft Answers forums for any other question.
  • Someone else has met a screen of the CC 2014 welcome distorted/biased?

    I'm under IA CC 2014.0.0 (v18.0.0) Mac OS x Lion 10.7.5.
    The content of the Welcome screen is distorted/biased.
    Someone at - he met - and resolved - this?
    Ai_CC_2014_Welcome_screen_-_skewed.png

    NOTE: I later update THE CC of v18.0.0 to v18.1.0.
    I get the same thing: distorted welcome screen.

    Sumit, I THANK YOU for your follow-up. It is certainly appreciated!

    I visited the thread you provided the link (above) [https://forums.adobe.com/thread/1512827] and reproduces the steps described in the last entry, by rebel Yankee on August 6, 2014, which is:

    Thanks for your reply, but the problem is no longer a factor. I went to AApplications/Adobe Illustrator CC 2014/Adobe Illustrator.app/Contents/MacOS/CEP/extensions and deleted the folder "com.illustrator.welcome". Who stopped.

    I had a problem of 16-up In-Design, timing of the launch. It starts but freeze then when the 'Welcome' screen appeared. I also deleted the docs of the In-Design Welcome screen in much the same way as described above for Illustrator. It then ceases to be a factor.

    Note about the waterway (/Applications/Adobe Illustrator CC 2014/Adobe Illustrator.app/Contents/MacOS/CEP/extensions) :

    In the case where someone else made use of this, you should know that when you get to "Adobe Illustrator.app" you must hold down the Ctrl key when you click on the application. Reveals it key to control, among other options, "Show Package Contents." Select it, and then the "Happy" folder Then follow the rest of the navigation instructions.

    The above worked for me; window not more welcome (distorted or otherwise).
    Even if this window is desirable for its links with new features, those which are accessible via the Illustrator main menu > help > Illustrator SupportCenter. This will take you to the page of the CC Illustrator on the Adobe website, where you can see these links:
    "Overview," "What's up," "learn & supports, ' and 'download '.

  • Case of Script

    Writing a script deal that would lead to a list in a drop-down that no problem. The question is that menu drop down box 1 push the list in the drop-Zone 2.

    There are 20 choices in the drop-Zone 1. 19 of these choices create exactly the same list in the drop-Zone 2. Once choices in the menu dropdown box 1 creates a different and unique list in the drop-Zone 2. Then...

    If the box in the drop Zone 1 = Option 1 then

    pulldownbox2. AddItem ("choice 1");

    pulldownbox2. AddItem ("option 2"):

    etc...

    If the box to drop box1 = something else Option 1 then

    pulldownbox2. AddItem ("different choice 1")

    etc.

    I want to avoid having to create a case of exactly the same list for 19 of the options if that makes sense.

    Thanks - pc

    Hello

    "" "You are very near here. '" With this, you could run in the DropDownField2preOpen event:

    // first clear DropDownField2
    
    this.clearItems();
    this.rawValue = null; 
    
    if (DropDownField1.rawValue == "Option 1")
    {
         // deal with the single case in the if statement
         this.addItem("Choice 1");
         this.addItem("Choice 2");
         this.addItem("Choice 3");
    }
    else
    {
         // deal with the remaining 19 cases in the else statement
         this.addItem("Choice A");
         this.addItem("Choice B");
         this.addItem("Choice C");
    }
    

    The foregoing is JavaScript. It is recommended that the script that determines the elements should be placed in the preOpen event.

    Hope that helps,

    Niall

  • The program window display problem

    It is not a huge problem, but it happened already - causing dispose me of the install or use program.

    I want to delete NORTON suite came with the pc. I downloaded their own removal, tool and, finally, he decided to NORTON has not been executed and produced his window and screen. Unfortunately, the pane below the edge of the screen and cannot be resized. Toggling with the arrow pointing upwards and pressing enter me have as much of an option that wouldn't work - to go new to the Next.

    I'm sure that there's something to fix this - the pc is connected on the SAMSUNG tv, so the display shrink.

    Please can someone help?

    To finalize this thread, I thought I'd share progress, in the case where someone else suffers from the same catalog of horrors that get rid of NORTON caused me.

    After having sent to HP and blame them for putting an a / v on a new pc with Win 7, rather than to provide a disk, as they did, I reconsidered my problem by uninstalling the remains of Startup and registry of NORTON. I got a bluescreen yesterday: Windows could not explain it, but Event Viewer said NORTON was trying to start. Tips from around the Web says to remove elements of Symantec/NORTON directly from the registry, but it's Aussie an area forbidden, even after saving the Reg. I downloaded autoruns progs - but it is hard to tell what elements must be deselected to Start. NORTON Safe Web Lite needs to stay.

    So, I went back to the NORTON uninstall TOOL. Now, for those of you who connect your pc to a TV, don't forget what I don't have: put an end to the end of the screen where you see. On a pc screen, the availability of the screen is still there, below the horizon [in the old days, we often "lost" a desktop icon that way].  I carried my another pc down to the desktop monitor (it's a grateful flat screen!) and set up, started the NORTON uninstall TOOL and waited. Even if the dialogue pane was too inflexible as ever, the edges of the buttons were simply achievable by pushing the mouse under the horizon.  NORTON all parties. My apologies for what is something so time-consuming, but people are trying to help, and I'm paying something in return.

  • macOS bug Sierra - Possible? (Terminal)

    I use the Terminal Df-h command to find the percentage of used space on the hard drive of my Mac, and I've noticed that since the upgrade to Mac OS Sierra; It came out that I used 0% (which may not be true); I was wondering could this be a bug and this is the case with anyone else?

    In fact, it is show you used 6% of disk space. 0 percent at the end relates the number of inodes that are used (data structures that manage the different metadata). Because you have so few files you are not yet using 1% of inodes, so he says always 0% are used.

    So, no, no bug

  • Why I have to sign in to IgHome every time I open my browser?

    I have two computers, one with xp and one with win 7. On xp, I open my browser and am ready to go. I click on gmail and my mail is opened. ON win 7 I have to connect to customize igHome and then signed to gmail to get the job.

    As the case with everyone else, I'm not too strong with computers.

    Any help or advise?

    Lomax007

    Details such as websites to remember you (automatically log you) are stored in a cookie.

    • Create a cookie 'allow' except to keep these cookies, in particular in the case of secure websites and when the cookies expire when Firefox is closed.
    • Tools > Options > privacy > "Use the custom settings for history" > Cookies: Exceptions

    In case you use "clear history of Firefox closing:

    • do not delete Cookies
    • do not delete Site preferences

    Note that compensation "Preferences of Site" clears all exceptions for cookies, images, pop-up windows, installation of software, passwords, and other specific data from Web site.

    Deletion of cookies will delete all specified (selected) cookies, including cookies with an exception allowing you want to keep.

  • HP Pavilion HPE h8-1090 t: Sidebar replacement

    Recently I cleaned our room of parts and as if by chance, he got rid of panel right side for this PC with several sides case old PCs.  Is it possible to get a spare stock for this PC?  Is there a way to get a replacement case, if nothing else?

    Hello Buggy52,

    Welcome to the HP Forums I'd like to take a moment and thank you for the use of this forum.

    I see that you are looking for the right for your Pavilion Desktop Panel. (LP032AV)
    You can visit our parts store to order one for your computer http://hp.care/2bAvpq6
    The part number you need to order is 644050-001

    Let me know if this helped.
    Have a great day.

  • Pavilion DV7T - 1200 CTO happened w / Wireless issues - work in progress - solved

    I took delivery on a DV7T yesterday.  It is configured with the minimap Intel 5100 AGN & Vista 32 Home premium (my first Vista machine).  I had updated my wireless router home in anticipation of his arrival, installation of a model of D - Link DIR-655 (Vista friendly 802.11n capable).  The router plays well with my existing XP laptop and has been configured for WPA2 AES & compatibility b/g/n.

    I configured the appropriate connection parameters and launched a manual connection.  I made changes to the router so the SSID was visible and defined the DV7T for automatic connection, but it took often more a minute before the DV7T would see even the network wireless and even a minute or two before reporting the signal strength. Each time, connection attempts failed, reports of a lack of response from the router.  After the double check (and returning) settings and password several times (and the audit by doing the same thing on another laptop which connected very well) I finally decided there was a problem and called for help.  Given that the order had been placed through Costco, I went through their Concierge as a first level service. Their script for was power off all computers (XP) on the network saying that a common problem was having a Vista machine join a network with XP already connected machines. No joy. Same lack of goodness after removing/reinstalling the drivers. It was as much as the script went to attempts at original resolution.

    At this point, no resolution & I plan just to return the machine for a refund (lack of wireless really it would damage the intended use). Propelled upwards all the equipment I had turned off.  Bored of not knowing for sure if it was an inherent incompatibility or a hardware problem (the day of delivery!)  I ended up out and pick up an express format card card N Wireless of Linksys.   Responsible drivers, plugged in the card and voila! immediately, the machine connects using the configuration of the connection that I had entered previously.  On top of that, the flow of data showed that 240-270 mbits.

    With this info, I went back to service, initially to the connection of Costco and then discussed in HP support. After a 3 hour marathon call, HP sends a replacement 5100AGN card to 'see if this fixes things', if it is not, the machine must go back to the service (as a problem of antennas would not be repairable client). Part of the duration of a call has been associated with finding the right part for a machine CTO.  The wireless card on my machine something SN (Broadcom) was set apart from the 5100 (although the list mentioned packing a minimap Intel next gen and the Manager device reports an Intel 5100AGN).  They have finally found a suitable part number (I hope).

    I just thought I would pass this along in case where someone else found themselves in a similar situation.  I'll post much after that the replacement property is displayed. As a side note, the Linksys N Ultra Rangeplus expresscard works really well as a replacement. Of course I'd rather not have something projecting from the side, but it certainly did the job.

    EDITION - ADDENDUM

    After the above post, I couldn't help but think that a problem of antennas sounded very probably - maybe a lead broken/disconnected (something I mentioned to the technology of the telephone service).  In any case, just a minute before, I went ahead and pulled the bottom panel, so I could take a look at the wireless card.  Technology said there would be two tracks running to the card - only was connected, the other has fallen in a crack between the card and the frame.  The wire not connected has been labeled "main" and there is a connector on the "main" labelled map  The two sons had been celo-glued to the card (in the broad sense), but I had the disconnected an oriented properly & pressed into the connector on the card.  He buttoned & turned on the machine.  He immediately finds the wireless network and connection has been made in a few seconds.

    My only ongoing question may turn out to be wireless performance.  Connection with the linksys card speeds were always above 200 (230-270).  Speeds, I see on the bed in so far have been initially lower than 100, with the best after being 150 mbits.  Any suggestions for how this can be improved?  Will the adapter 'learn' alone and get better over time?

    FINAL ADDENDUM-

    Model found on another forum that the 5100AGN has apparently a maximum 150 Mbps on a 300 Mbps max for RX & TX... the 5300AGN is 300 in both directions.

    This suggests that the 150 that I see is as good as it gets for my integrated card. Apparently, the Linksys expresscard I used is good for TX/RX 300.

    Nick

    Message edited by skhowell on 02/21/2009 08:22
    Message edited by skhowell on 02/21/2009 17:00

    I don't know that the costco guys worked just for the trouble shooting script, he gave.  On the plus side, he had an understanding of the issues, & spoke vernacular American English (and not in a call center offshore).  He was ready to continue, but I needed a time out.  The second call (after me obtain Linksys for comparison) was good enough and the technology was very ready he climbs to a technician of HP (once again, the continent - not off shore), which was certainly ready to order a replacement part, but crossed a few last checks more that the internal card could not be implemented. The part was sentenced & will be shipped without requiring a deposit of me. The only negative for telephone exchanges, it's neither opening proposed leads the lower panel to check the antennas have been connected correctly.

    As stated in the original post - edited-, the final fix was to open the Panel & visually notice that a 'primary' marked lead was not connected to the wireless card.  Attaching which lead to the consequence named connector on the Board eliminated the problem.   The disparity of the connection speeds between the internal 5100AGN and the Linksys 802.11n expresscard was due to the limitations of card design (150TX/300RX 5100AGN and 300 TX/RX for the Linksys), so the 150 Mbps I see currently for internally is as good it will become.  I'll probably send the rear replacement not opened as opposed to actually Exchange cards. (I don't think that the shipment may be shortstopped at this point...).

    Nick

  • Mysterious text highlight

    Hello

    I hope someone here can help me with this:

    A light blue highlight appeared in my window chat IM, but only on the words 'this' and 'is '.

    It affects all entries in conversation if the mine or the people I chat with but it appears only in my window and no one else.

    This isn't really stop me using Skype, but it IS really annoying!

    Can someone tell me how to solve this problem?

    Thank you

    A.

    OK - panic over!

    It wasn't only the words 'this' and 'is' but the words: 'this', 'is', 'one', 'alert! '

    Just in case where someone else is to reflect on this problem:

    Under the menu 'Conversations', there is an entry named "parameters of Notification... "- that open and click on the box marked"Don't warn me. " It does not appear to erase the text that has already been said, but it stops it happening more!

    It looks like to what could be a useful tool for keeping track of specific things in a big cat so it is probably worth to look at how to use wisely - I know I will!

    Thank you and sorry for wasting time!

    A.

  • Re: Satellite T110-107 will not start in the form of recovery option using the f8 key.

    I tried several times and can't get the option of recovering your system by typing intermittently the * key f8 during the startup * as it says in the manual, it will just directly in Windows. I just installed the latest version of the BIOS, but that did not help either. I have no recovery discs, but I would get the f8 problem solved in any case. Everything else works perfectly. Thank you.

    Hello

    Maybe you didn t press F8 in the right way
    You must press F8 immediately after the laptop has been powered!
    Press several times to be sure 100%

    If this does not work, create the recovery disk! This should be done first before you do anything with the laptop!
    The recovery disk is always important and useful if something goes wrong with the HARD drive!

    After you create the recovery disk using this drive to put the laptop in the same State as on the first day of purchase

  • Satellite L650-108 blue screen in wake up

    Hi guys,.

    I recently bought this laptop and it works wonderfully, that I have no complaints about the portable reality itself.
    The only problem is that twice now he has projected in wake up from stand-by blue or sleep.

    Now there fell asleep on a lot more opportunities than it without no problems waking up.
    I don't know why he randomly did this twice.

    I'm not quite the mistake but it was something about driver HD I think.
    I'll get it and report it here the next time it happens. I was wondering if it's something to do with the facial recognition software?

    So why the error message is on the HD video driver (if this is the case).
    Anyone else having similar problems with any of the laptops out there?

    PS: I've updated the drivers on the Toshiba support site.

    Thanks for the help
    Scott

    Hi Scott

    Have you noticed that it started to happen after a few updates Microsoft installation? I had similar problem on my older Satellite. I wasn't able to fix it, but I'm 100% sure that some update from Microsoft is responsible for this.

    What do you think of all this? To be honest I have don t think some update driver will solve the problem.

Maybe you are looking for