SQL single-line functions in Oracle databases-character Functions

Source: Internet
Author: User

SQL single-line functions in Oracle databases-character Functions

This learning is about character functions.
Character Functions
Character functions can also be divided into case-insensitive conversion functions and character processing functions.
Case-sensitive conversion functions
1. LOWER: Convert to lower case [SQL] select LOWER ('oracle ') from dual; dual is a virtual table. We often use virtual tables for some related exercises.

2. UPPER: Convert to uppercase [SQL] select upper ('oracle ') from dual; 3. INITCAP: uppercase [SQL] select INITCAP ('oracle') from dual;
String processing functions
1. CONCAT: String concatenation function, similar to "|" [SQL] select concat (ename, 'employee ') from emp;
2. SUBSTR: String truncation function (tips: subscript starts from 1) [SQL] select substr (ename, 1, 3) from emp;

3. LENGTH: returns the string length [SQL] select LENGTH (ename) from emp; 4. INSTR: returns the position of a string in another string [SQL] select instr (ename, 'k') from emp; 5. Left fill for LPAD and RPAD, right fill for [SQL] select rpad (sal, 6, '*') from emp; -- do not fill "*" on the right side of the six-digit Database
-- Left filling is not demonstrated. However, it should be noted that if sal itself is null, it will not be filled.

6. TRIM: remove the specified characters (TIPS: this function is very powerful and will be mentioned later) [SQL] select TRIM ('S' from 'ssmith ') from emp; -- Here is a recursion"

7. REPLACE: replace the string [SQL] select REPLACE (ename, 'K % iritor ', 'oracle') from emp where ename = 'K % iritor ';

Tips: As can be seen from the above functions, these functions process a "record", so they are single-row functions.

Well, the built-in character functions are not listed yet, and you need to summarize them later.

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.