- Oracle
- The syntax format is as follows:
- Lpad (String, Padded_length, [pad_string])
- String
- Prepares the string to be filled;
- Padded_length
- The length of the string after padding, that is, the length of the string returned by the function, if the number is shorter than the length of the original string, the Lpad function will intercept the string as a left-to-right n character;
- Pad_string
- Padding string, is an optional argument, this string is to be pasted to the left of string, if this parameter is not written, the Lpad function will paste a space on the left side of the string.
Source: > [SQL] View plaincopy
- Select Lpad (22,10,' 0 ') from dual;
- Results:
- 1 0000000022
Sqlserver:right function
Grammar
Right(
string,
length)
RightThe syntax of a function has the following named arguments:
Part |
Description |
String |
Necessary parameters. A string expression in which the rightmost character is returned. If string contains null, nullis returned. |
Length |
The necessary parameters are Variant (Long). As a numeric expression that indicates how many characters you want to return. If 0, returns a 0-length string (""). If the number of characters is greater than or equal to string , the entire string is returned. |
Example:
Right (Replicate (' 0 ',ten) +ltrim (parametric),ten)
- Oracle
- The syntax format is as follows:
- Lpad (String, Padded_length, [pad_string])
- String
- Prepares the string to be filled;
- Padded_length
- The length of the string after padding, that is, the length of the string returned by the function, if the number is shorter than the length of the original string, the Lpad function will intercept the string as a left-to-right n character;
- Pad_string
- Padding string, is an optional argument, this string is to be pasted to the left of string, if this parameter is not written, the Lpad function will paste a space on the left side of the string.
Source: > [SQL] View plaincopy
- Select Lpad (22,10,' 0 ') from dual;
- Results:
- 1 0000000022
Sqlserver:right function
Grammar
Right(
string,
length)
RightThe syntax of a function has the following named arguments:
Part |
Description |
String |
Necessary parameters. A string expression in which the rightmost character is returned. If string contains null, nullis returned. |
Length |
The necessary parameters are Variant (Long). As a numeric expression that indicates how many characters you want to return. If 0, returns a 0-length string (""). If the number of characters is greater than or equal to string , the entire string is returned. |
Example:
Right (Replicate (' 0 ',ten) +ltrim (parametric),ten)
SQL left-Padded