Three Common oracle functions TRIM, TRUNC, and DECODE

Source: Internet
Author: User

Three Common oracle functions TRIM, TRUNC, and DECODE are used. Today, three functions TRIM, TRUNC, and DECODE are met. The experience is recorded for future reference. 1. TRIM function: used to remove spaces at the beginning and end of a string line. Www.2cto.com select trim ('yichangzyh') "TRIM e.g." FROM dual; TRIM e.g. YICHANGzyh 2. TRUNC function: truncation function. SELECT trunc (sysdate) "trunc (sysdate)" trunc (sysdate, 'Year') "trunc (sysdate, 'month')", trunc (sysdate, 'month ') "trunc (sysdate, 'day')", trunc (sysdate, 'day') ", trunc (sysdate, 'hh24')", trunc (0 minutes 0 seconds )", trunc (sysdate, 'mi ') "intercepted to minutes (0 seconds)" FROM dual; intercepted to the day, intercepted to the first day of the year, intercepted to the first day of the month, intercepted to the first day of the week, the hour (0 minutes 0 seconds), minute (0 seconds), 17:00:00, 17:02:00, 3. DECODE function: Conditional judgment. Www.2cto.com decode (condition, value 1, return value 1, value 2, return value 2 ,... value n, RETURN value n, default value) the meaning of this function is as follows: IF condition = value 1 then return (translation value 1) ELSIF condition = value 2 then return (translation value 2 )...... ELSIF condition = value n then return (translation value n) else return (default value) END IF

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.