LPAD()
Description
This function LPAD(str,len,padstr) returns the string str, left-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters.
Syntax
1. > LPAD(str,len,padstr)
Arguments
| Arguments | Description |
|---|---|
| str | Required. The string to be padded. CHAR and VARCHAR both are supported. |
| len | Required. |
| padstr | Required. The string used to pad on the left. CHAR and VARCHAR both are supported. |
Examples
1. > drop table if exists t1;
2. > create table t1(a varchar(10));
3. > insert into t1 values('mo');
4. > select a, lpad(a,8,'good') AS lpad1,lpad(a,1,'good') AS lpad2,lpad(a,-1,'good') AS lpad3 FROM t1;
6. +------+----------+-------+-------+
7. | a | lpad1 | lpad2 | lpad3 |
8. +------+----------+-------+-------+
9. | mo | goodgomo | m | NULL |
10. +------+----------+-------+-------+
Constraints
Currently, MatrixOne doesn’t support select function() without from tables.
