Oracle Intercept character (SUBSTR), retrieving character position (instr) case when then else End statement uses ____oracle

Source: Internet
Author: User

Common functions: Substr and InStr

1.SUBSTR (string,start_position,[length]) to substring, return string

Explanation: String Meta string

Start_position starting position (starting from 0)

Length optional, number of substrings

For example:

substr ("ABCDEFG", 0); Back: ABCDEFG, intercepting all characters
substr ("ABCDEFG", 2); Back: CDEFG, intercept all characters after starting C
substr ("ABCDEFG", 0, 3); Back: ABC, intercept 3 characters starting from a
substr ("ABCDEFG", 0, 100); Return: abcdefg,100 Although the maximum length of the preprocessed string is exceeded, it will not affect the return result, and the system is returned at the highest number of preprocessing strings.
substr ("ABCDEFG", 0,-3); Return: EFG, note that parameter-3, when negative, indicates that the string arrangement position is unchanged from the tail start.

2.INSTR (string,substring,position,ocurrence) Find string position

Interpretation: string: Source string

SubString: substring to find

Position: Start position of Lookup

Ocurrence: The first occurrence of substrings in the source string

For example:

INSTR (' CORPORATE FLOOR ', ' or ', 3, 2), the source string is ' CORPORATE FLOOR ', the target string is ' OR ', the starting position is 3, the position of the 2nd match is obtained; the result is 14 '

Use of case when then else end in a 3.SQL query

SELECT
Case R.req_status
When ' New ' THEN
New
When ' callbacking ' THEN
Reply
ELSE
Test
End as TEST
From Tb_support_req R

Equivalent to Java in the

if () {

...

}else if () {

...

}else{

...

}

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.