Common Oracle Functions

Source: Internet
Author: User

1,Ceil (N)Function: Take a value greater than or equal to a value.NThe smallest integer

 

2,Floor (N)Function: Take a value less than or equalNThe maximum integer

 

3,InstrAndLimit B: Query the position of the target string in the source string,InstrIs in character format,Limit BByte mode

The format of the instr method is
Instr (source string, target string, start position, matching serial number)
For example, in instr ('upgrade floor ', 'or', 3, 2), the source string is 'upgrade floor', the target string is 'or', And the start position is 3, the position of the 2nd matching items is 14.
The default search order is left to right. When the start position is a negative number, search from the right side, but the position is calculated from left to right.
So

Select instr ('upgrade floor ',' or ',-1, 1) "instring" from dual:
Instring
------
14

 

4,LengthAndLengthb: Evaluate the length of the stringLengthIt calculates the length of characters,LengthbThe length of the byte is calculated.

 

5,SubstrAndSubstrb:Returns the string with the specified start position and length.SubstrTruncate by character,SubstrbIntercept by byte

Format: substr (string, start_position, [length])
Start_position: When the value is positive, it starts from the left.

When it is a negative number, it starts from the right.

[Length]: an optional parameter. If this parameter is required, it indicates that the value ranges from start_position to the end of the string.

If length has a value, it is a string with the length from start_position to the right.

Example:

Substr ('this is a test', 6, 2) wowould return 'is'
Substr ('this is a test', 6) wocould return 'is a Test'
Substr ('techonthenet ', 1, 4) wocould return 'tech'
Substr ('techonthenet ',-3) wocould return 'net'

Substr ('techonthenet ',-3, 3) wocould return 'net'
Substr ('techonthenet ',-6, 3) wocould return 'the'
Substr ('techonthenet ',-8, 2) wocould return 'on'

 

 

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.