Oracle Single-line function base application

Source: Internet
Author: User

single-line function

Whole the essence of SQL:Select statement + single-line function (back)

String Functions

The usual functions for working with strings are as follows :

No.

Name of function

Meaning

1

UPPER (C1) UPPER

To capitalize all strings

2

LOWER (C1) LOWER

Convert all strings to lowercase

3

Initcap (C1) Initcap

Capitalize the first letter of a string

4

LENGTHC (c1) length

Returns the length of a string

5

SUBSTR (C1,n1[,n2]) SUBSTR

Gets the substring of the string,N1 is the specified starting index,n2 is the specified number of numbers, and if n2is not written, the last one istaken.

6

Replace (C1,C2) Replace

String substitution,C1 is the old sub-character,C2 is the new substring

topic 1: Convert the string "WelcomeTozibo" to uppercase.

Select Upper (' Welcometozibo ') from dual

Topic 2: convert all employee names in the EMP table to lowercase.

Select Lower (ename) from EMP

Topic 3: The employee's name is entered by the user, and all information about the employee is displayed.

SELECT * from emp where ename= (' &input ')

can also be combined with upper using the SELECT * from emp where ename=upper (' &input ')

Topic 4: Query the emp table for all employee names and return the initials capitalized.

Select Initcap (ename) from EMP,

Topic 5: Query employee number, employee name, and position for all employees with employee name length 5.

Select Ename,job,empno from emp
where length (ename) = ' 5 '

Substr ( string, the index of the character search character to search for (you can use instr(String, the character to be searched, the number of times a character appears, and the frequency at which it occurs) is the end (Length ( characters that need to be intercepted )))

Topic 6: Get the string ' Welcometozibo ' substring ' zibo '.

Topic 7: Get the string ' Welcometozibo ' substring ' come '.

Title 8: Obtain the name of the employee of each employee of the EMP table, and the first two of the employee's name.

Substr from the back directly with '-' default starting from the last , only from the last one to which.

Title 9: Obtain the name of the employee of each employee of the EMP table, and the last two digits of the employee's name.

title : Obtain the name of the employee of each employee of the EMP table, the first two digits of the employee's name, and the last two digits as the password.

Oracle Single-line function base application

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.