Uncommon functions in oracle

Source: Internet
Author: User
Tags case statement


Oracle does not commonly use function 1, coalesce -- returns the first non-null parameter in the parameter list. The last value in the parameter list is usually the constant www.2cto.com. Case: If bonus is not null, result: bonus. If bonus is null, salary is not null. Result: salary * 15. If bonus is a slave, salary is null. Result: 100 SQL code select coalesce (bonus, salary * 15,100) bonus 2, case statement -- the branch statement in the database, which is equivalent to the switch-case in the database. if the job is Analyst, salary * 1.1 if the job is Programmer, salary * 1.05 if the job is clerk, salary * 1.02 other job, salary * 1 www.2cto.com SQL code select salary, case job when 'analyst' then salary * 1.1 -- note that there is no ", "when 'scheme' then salary * 1.05 when 'cler' then salary * 1.02 else salary -- else is equivalent to the default end new_salary in java -- end is the concluding sentence of the case statement.
 

Related Article

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.