start end in if then else.

Hello

I've seen people to help

If 1 = 1 then

HOMELESS: = 9;

on the other

HOMELESS: = 10;

end if;

or


If 1 = 1 then
Start
HOMELESS: = 9;
end
on the other
Start
HOMELESS: = 10;
end;
end if;

(1) which is good. (good coding practices)
(2) is it wrong by removing start end if then else.

what I show begin end can be used for the management of exceptions, if it can be used for any other things please tel me.


Yours sincerely

944768 wrote:
what I show begin end can be used for the management of exceptions, if it can be used for any other things please tel me.

The previous poster gave you good links.

In your example, I think that putting BEGIN/END in each IF/ELSE condition is rare and would not be useful, so I'd omit them.

Nested BEGIN/END blocks can be useful If you want to:
(a) put a label, or
(b) DECLARE a variable that will be used only within that block, and/or
(c) write a specific EXCEPTION handler.

Since your example only none of that above, I don't see the use of these nested blocks. When something is useless, do not.

P.S. If the goal is to write modular code, anonymous blocks can declare functions and procedures that can be called from the main block.

set serveroutput on
DECLARE
  PROCEDURE proc_inside(p_msg in varchar2) IS
    BEGIN
      dbms_output.put_line(
        'Message from procedure within an anonymous block: '||p_msg
      );
    END proc_inside;
BEGIN
  proc_inside('Message A.');
  proc_inside('Message B.');
END;
/

anonymous block completed
Message from procedure within an anonymous block: Message A.
Message from procedure within an anonymous block: Message B.

Published by: Ashton stew on March 10, 2013 16:46

Tags: Database

Similar Questions

  • Windows startup is not full, and then after a few seconds that the starting ends.

    windows startup is not full, and then after a few seconds that the starting ends.

    Original title: boot of win7

    Yes, it's the way it happens. All the other stuff are load - computer office, drivers, anti-virus, etc.
    It takes longer is that you have a lot of programs that load with Windows.
    and is faster if you have Windows on a SSD instead of a disk hard standard tray.
    Win7 also much faster than XP load, anything.

  • Can't get my GMail password! Settings > mail > Gmail: press the "re - enter Password' and the window starts to load, but then disappears.

    In my settings > Mail, Contacts, calendar, Notes under accounts is my GMail account which works perfectly well on my iPhone 6 until what I changed my GMail password. Of course, the next time I go to check my GMail emails on my phone (NOTE: I do not use a separate Gmail application) it tells me to update my password in settings.

    When I try to do it, by pressing the blue text "Reset Password", the Gmail window starts to open and then immediately disappears!

    I've been scouring the internet everyday looking for a solution. I tried the phone off (properly) and then restarting him. That did not help. I tried settings > Mail, Contacts, calendar, notes 'Add an account' but when I press 'Google' I have the same thing - the window starts loading, then it disappears.

    Just out of curiosity, I typed as others (iCloud, Exchange, Yahoo, AOL and Outlook) on the list and they all open a screen except for Google and Yahoo, which also starts loading but then disappears immediately. I wonder why it happens that Google and Yahoo? (I don't have a Yahoo email account configured on this phone. Only Gmail and Exchange (for work, that works perfectly, no problems with this one)

    So, when I tried failed to load Google connection/settings window, click on 'Other' on this list, thinking maybe I'll manually add my GMail account again (as a IMAP), but the iPhone doesn't let me do that without also configuring servers of incoming/outgoing mail as if it were a POP configuration? I gave up that idea.

    What I really want, it's simply Reset my password on my phone to my Gmail account in the settings. Does anyone else have this problem? Y at - it a bug known in this regard? Is there a work around for this? I'm doing something wrong? I have to take this phone to an Apple store and get help here?

    SOLVED! I thought about it. As usual, at the point where I have ask for help is when I tell me how to solve. It's simple, really. I was at work, so I guess that the security settings on the wifi of the company prevented me to access these panels (for some odd reason)? I simply turned off the wifi in the settings, and everything works perfectly.

    I hope that if all the world is facing the same question that helps.

  • if-then-else logic

    Here's the test with values from the table and insert.


    create table students (
      name varchar2(25 BYTE),
      joined_date DATE,
      exam_type VARCHAR2(25 BYTE),
      SCORE NUMBER(2,1),
      CUT_OFF_DATE DATE
     );
    insert into students values('john','26-mar-14','SCREEN',7.6,'10-apr-14');
    insert into students values('john','10-Apr-14','RETEST',8.0,'10-apr-14');
    

    I try to return the single folder with the score of the same name of the student. I use CASES, but he really do not act as "IF-THEN-else" as the use of a control statement.


    select name,
      joined_date,
      case 
      ---something like IF statment if below[b] statement 1[/b] --is true then it
      --should return below statement
      when exam_type ='SCREEN' and score between 8.0 and 10.0
      then score
      ----[b]statement 2[/b] --if above expr fails, the below to be executed
      when exam_type ='RETEST' and score between 8.0 and 10.0
      and joined_date >= cut_off_date
      then score
      else null
      end result
    from students;
    

    output-

    Name joined_date Result
    John26/03/14
    John04/10/148


    in the game of results above, I need only the score of '8' and 'John' and the unique records only? like this, there are more then millions of records must be calculated.

    Please help me with logic


    Thank you

    Jason

    Well,.

    in this case, you will need to use something like ROW_NUMBER to keep only the "first" instance:

    SELECT name,

    joined_date,

    exam_type,

    score

    FROM (select s.*,

    ROW_NUMBER() over (partition by order of name of joined_date) rn

    s students

    where 1 = case when (exam_type = "SCREEN" and score between 8 and 10)

    or (exam_type = "RETEST" and the score between 8 and 10 and joined_date > = cut_off_date)

    then 1

    end

    )

    WHERE rn = 1;

  • Help to fic my if-then-else logic in Forms 6i

    Hello world
    I have the following if-then-else in a when-validate-point called trigger where I'm trying to make it work the way I want to, but only works if I have 3 numeric values for each item. If put a letter in one of them, then I get the following error:
    FRM-40735: WHEN-VALIDATE-ITEM trigger raised unhandled exception ORA-06502.
    Can someone please help me fix my logic?
    Begin
    If (:BLOCK1.ITEM1 BETWEEN 0 AND 100) and (:BLOCK2.ITEM2 BETWEEN 0 AND 100) and (:BLOCK3.ITEM3 BETWEEN 0 AND 100) Then
    :BLOCK1.ITEM4 := (:BLOCK1.ITEM1*0.40) + (:BLOCK1.ITEM2*0.40) + (:BLOCK1.ITEM3*0.20);
    Elsif
    (:BLOCK1.ITEM1 IN ('F', 'P', 'NA')) and (:BLOCK1.ITEM2 BETWEEN 0 AND 100) and (:BLOCK1.ITEM3 BETWEEN 0 AND 100) Then
    :BLOCK1.ITEM4 := (:BLOCK1.ITEM2 + :BLOCK1.ITEM3)/2;
    Elsif
    (:BLOCK1.ITEM2 IN ('F', 'P', 'NA')) and (:BLOCK1.ITEM1 BETWEEN 0 AND 100) and (:BLOCK1.ITEM3 BETWEEN 0 AND 100) Then
    :BLOCK1.ITEM4 := (:BLOCK1.ITEM1 + :BLOCK1.ITEM3)/2;
    Elsif
    (:BLOCK1.ITEM1 IN ('F')) AND :BLOCK1.ITEM2 IN ('F')) AND (:BLOCK1.ITEM3 IN ('F')) Then
    :BLOCK1.ITEM4 := 'F';
    Elsif
    (:BLOCK1.ITEM1 IN ('P')) AND (:BLOCK1.ITEM2 IN ('P')) AND (:BLOCK1.ITEM3 IN ('P')) Then
    :BLOCK1.ITEM4 := 'P';
    Elsif
    (:BLOCK1.ITEM1 IN ('NA')) AND (:BLOCK1.ITEM2 IN ('NA')) AND (:BLOCK1.ITEM3 IN ('NA')) Then
    :BLOCK1.ITEM4 := 'NA';
    Else
    Null;
    End if;
    End;
    Published by: user626836 on September 28, 2011 08:42

    Published by: user626836 on September 28, 2011 08:54

    Yes, everywhere, wherever you want to see the numerical score or Alpha you will use this code. Depending on your version of the database of the stated CASE may not work, but all versions support DECODING.

    Craig...

    Published by: Silvere Sep 29, 2011 07:18

    I need to clarify... the DECODING is a SQL function. If you can't use it in SQL queries. You will get a compiler error if you try to use the DECODE function in PL/SQL.

  • How to get if THEN ELSE another condition table

    Hi eveybody,.
    I have a situation and I need your advice guys.
    I apply if THEN ELSE condition in PL/SQL from another table. I do the merger in tableA that will run IF Column1 in tableC = Y.
    Ex: Tablec has three columns: source, dest, condition. Condition IF = Y in tableC, then merge into tableA use (Sql query in table C source selection) B.

    Please let me know how to get the condition = Y of table C.
    Condition IF = Y for each source in C, then fusion will happen for this source.

    Please provide your comments and your responses.
    I'd really appreciate your comments and your responses.
    Thank you very much.

    user13426784 wrote:
    DB link is passed as parameter in MS and we need to check the status for this link db to TableC.

    select   status
      into  v_status
      from  tableC
      where db_link = v_source;
    if v_status = 'Y'
      then
        EXECUTE IMMEDIATE 'MERGE INTO tableA A USING
    (select  from tableA@' || v_source || ')B
    when matched insert
    when not matched update';
    end if;
    

    SY.

  • Unable to minimization/maximization if-then-else block

    When you change a procedure, I lost the ability to minimization/maximization of a block if-then-else. How to bring back this feature? I'm using version 1.5.1 build HAND-5440.

    Have a look at tools > Preferences > Code Editor > display - he has a preference "Show Code folding margin. If this were put in judgment you don't get the code folding margin in the editor. However, if your code folding margin appears (preference is on) but doesn't give you any points trick, remember that there may be a noticeable delay between opening the code editor and the fold points scored - more code, it may be.

    Finally, there was a change at a given time (don't remember the version it was introduced) where the section of code to be folded must exceed three lines you can collapse it. For example, it won't give you an option to fold:

    if condition then
      single line of code;
    end if;
    

    but it will be:

    if condition then
      single line of code 1;
      single line of code 2;
    end if;
    

    theFurryOne

  • FB does not open on my iPad after my upgrade of the OS to 9.3.2 he starts to open but then returned to the screen.

    I just transferred most of my photos which prevented me to upgrade my OS. Now, the upgrade is complete (9.3.2) FB starts to open but then goes back to the desktop. Same thing for my YouVersion Bible. I thought maybe I could uninstall FB and reinstalling, but see how.

    To remove Facebook and YouVersion bible app, tap on and hold the icons (one at a time) until it wiggles. Then press the X in the upper right of the icon. Go to the App Store to install their return.

  • Cannot open iMovie 10.1 since update to El Capitan. It starts to load, and then closes unexpectedly everytime. Older version of iMovie (8.0.6) still works. Any suggestions?

    Cannot open iMovie 10.1 since update to El Capitan. It starts to load, and then closes unexpectedly everytime. Older version of iMovie (8.0.6) still works. Any suggestions?

    Try starting with the ALT key down.  It waits for you to choose a library to open it.  If it does not open your library then there is something wrong with the library.

    Try running after have connected you to your computer under another account if it works, there is something wrong with the configuration of your account

    Try to remove and then reinstall iMovie

    Geoff.

  • Will not install driver installer of EPSON Scan (L210) - ' error occurred when installing re start the computer, and then try again.

    Original title: problem installing scanner

    EPSON Scan (L210) setup driver moved - "is an error occurred when installing re start the computer, and then try again.

    Hey there, MAHIPALSINGH143

    Welcome to the Microsoft community forums.

    So that the community help to install your printer, we will need more information. Please answer these questions:

    1. Windows what operating system are you running (Windows 10, 8.1, 7)?
    2. The troubleshooting steps have so you far?
    3. Did you upgrade to a new operating system?
      1. If Yes, what operating system you were on before?

    When you look at the error message, it doesn't look like you need to update your drivers. You will need to go on the official website of manufacturers, with your EPSON.

    Here is the site for the EPSON drivers: http://www.epson.co.uk/gb/en/viewcon/corporatesite/support

    When I entered your model of "Epson Scan (L210)" number, it does not recognize the product. Would you be able to check and make sure that you have provided the correct model number? Your model is a new printer?

    Kind regards

  • Could not open windows live mail, guard saying my calendar file is corrupted by this # at the end of 0x8E5E0220, then closes

    I have XP Pro.  I can't open windows live mail, he repeats to me that my calendar file is corrupted by this # at the end of 0x8E5E0220, then closes. any help would be appreciated

    Thank you

    David

    Hello

    The question you have posted is related to Windows Live, and would be better suited in the Windows Live forum. Please visit the link below to find a community that will provide the support you want. http://windowslivehelp.com/

  • krst Checkpoint error - when my computer starts, that it starts to power, but then turns off when it is at the Dell logo screen

    When starting my computer it starts to turns on then shuts off when it gets to the Dell logo screen.

    How can I fix?

    Hello

    Try the methods in the links below and check if it helps.
    Windows XP restarts unexpectedly or restarts when you shut down the computer
    http://support.Microsoft.com/kb/320299

    Windows XP restarts when you try to shut down your computer
    http://support.Microsoft.com/kb/311806

    I hope this helps.
  • Press and hold Ctrl/Alt, then press on delete, and select Start Task Manager, and then the small black box appears and then disappears.

    Press and hold Ctrl/Alt, then press on delete, and select Start Task Manager, and then the small black box appears and then disappears.  How can I fix the Task Manager?

    Hello

    See if that helps you.

    "The problems of Task Manager.

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-Task-Manager-problems

    See you soon.

  • Windows does not start: every time I type my password it starts to load, but then it freezes

    Help, please!

    • my windows vista family premium does not pass the login window, every time I type my password it starts to load, but then it freezes
    • I already try to restart my computer, but it of not working, now will work in safe mode
    • WHAT CAN THE PROBLEM PLEASE HELP!

    Follow these steps to try to solve your problems of boot.

     

    Restore point:

    http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/

    Do Safe Mode system restore, if it is impossible to do in Normal Mode.

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    http://www.windowsvistauserguide.com/system_restore.htm

    Read the above for a very good graph shows how backward more than 5 days in the System Restore Points by checking the correct box.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     

    If the system or Mode restore safe work not and you do not have a Microsoft Vista DVD, make a repair disc to do a Startup Repair:

    Download the ISO on the link provided and make a record of repair time it starts.

    Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.

    At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu.

    When you have changed that, insert the Bootable disk you did in the drive and reboot.

    http://www.bleepingcomputer.com/tutorials/tutorial148.html

    Link above shows what the process looks like and a manual, it load the repair options.

    NeoSmart containing the content of the Windows Vista DVD 'Recovery Centre', as we refer to him. It cannot be used to install or reinstall Windows Vista, and is just a Windows PE interface to recovering your PC. Technically, we could re-create this installation with downloadable media media freely from Microsoft (namely the Microsoft WAIK, several gigabyte download); but it is pretty darn decent of Microsoft to present Windows users who might not be able to create such a thing on their own.

    Read all the info on the website on how to create and use:

    http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/

    ISO Burner:http://www.snapfiles.com/get/active-isoburner.html

    It's a very good Vista startup repair disk.

    You can do a system restart tool, system, etc it restore.

    It is NOT a disc of resettlement.

    And the 32-bit is what normally comes on a computer, unless 64-bit.

    See you soon.

    Mick Murphy - Microsoft partner

  • Driver EPSON Scan Setup installs - "error produced during installation to re start the computer, and then try again.

    New Epson Scanner GT - S50 Epson scan, set up driver will not install. keeps giving me "is an error occurred when installing re start the computer, and then try again" works fine on another pc with windows 7, but not from Dell. Tried to download from the website and cd. all other software is loading fine. Epson technical support cannot fix. Help!

    I finally had my Epson GT - S50 working. I have a contract with support iYogi.They tech were recommended by Dell.  It took them more than 12 hours to solve this problem. They had to do a full factory reset. I have had all my drives. The alleged problem with mine was HP. I have a hp all-in-one. It damaged my windows files. On re install, I had to install Epson scan first, this hp. I would not buy an epson again. The product works well now but still double flow a lot and is very picky. When it works well, it really accelerates my work verse scan with the Hp all-in-one. I'm really happy that I have a scanner, but wouldn't recommend an Epson.  I highly recommend I have Yogi tech support. They are worth every penny.

Maybe you are looking for

  • How can I change the keyboard on an existing concert controller

    Hello I have a concert that I created using a controller of oxygen 49 but I want to save a copy of the same concert that uses another controller for when I don't have the oxygen with me. I thought I'd be able to simply select the other controller ins

  • Menu of performance graph 3D point cloud

    Menu custom graphic execution 3D point cloud does not (Advanced-> Run-time). The default menu can also not be disabled.  Turn it off does not work (Advanced-> Run - time-> Disable and properties VI-> the appearance of the window-> Custom-> allow defa

  • I have a problem my OS loading

    Hi, my laptop HP mini 110-1020LA need a password for bios and I don't have the password. s/n is [redacted serial number by Moderator] could you help me?, please

  • Change the spell check language used in Outlook Express

    When I use the spellchecker in Outlook Express, the dictionary uses only French.  I followed the instructions to change the language it uses, but the French is the selection available only.  How can I get English (Canada) as a selection available?  I

  • How to download microsft word

    I have windows vista installed on my laptop and im trying to install microsoft word. However, the cd that came with the computer has windows xp... and I'm not sure how to download from there