Branch statements in Oracle

Source: Internet
Author: User

In Oracle, the branch statement condition branch statement: www.2cto.com pl/SQL provides three branch statements: if -- then, if --- then -- else, if -- then -- ifesle, you can enter an employee name. If the employee's salary is lower than 2000, the employee's salary will be increased by 10% create or replace procedure chenchuang_pro (namevarchar2) is defined variable v_sal emp. sal % type; begin: select sal into v_sal fron emp where ename = name; Judge if v_sal <2000 then update emp set = sal * 1.1 where ename = name; end if; end; in this process, www.2cto.com ---------------------------------------------------------------- dual-condition branch if -- then -- else writes a process and you can enter an employee name, if the employee's subsidy is not 0, it will increase by 100 based on the original one. If it is 0, it will set the subsidy to 200 create or replace procedure chenchuang1_pro (namevarchar2) is to define the variable v_comm emp. comm % type; begin starts to execute select sal into v_sal fron emp where ename = name; Judge if v_comm <> 0 then update emp set = comm + 100 where ename = name; else update emp set = comm + 200 where ename = name; end if; end; ========================================================== ========================= procedure: this is the keyword emp in the creation process. comm % type: indicates that the type of the variable is the same as the type and size of the comm field in the emp table. <>: in Oracle, the value is not equal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.