Oracle lpad Functions

Source: Internet
Author: User
Oracle lpad functions:

Copyright Notice: Mark the reprinted object with a hyperlinkArticleOriginal Source and author information andThis statement
Http://soysky.blogbus.com/logs/43623642.html

The Oracle lpad function fills the string on the left with some specific characters. The syntax format is as follows:

 

Lpad (string1, padded_length [, pad_string])

 

Where:

String1 is the string to be pasted;

Padded_length is the number of returned strings. If the number is shorter than the length of the original string, the lpad function splits the string into padded_length. pad_string is an optional parameter, this string is to be pasted to the left of string1. If this parameter is not written, the lpad function will paste a space on the left of string1.

 

For example:

Lpad ('tech ', 7); will return 'tech'

Lpad ('tech ', 2); will return 'te'

Lpad ('tech ', 8, '0'); will return 'technical tech'

Lpad ('tech on the net', 15, 'z'); will return 'tech on the net'

Lpad ('tech on the net', 16, 'z'); returns 'ztech on the net'

 

Lpad (str1, number, str2), which simply means that if str1 is less than number, then use str2 to fill the left blank

Eg:

Select lpad ('***', 6, 'orcal') from dual

-- Result

ORC ***

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.