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

ArgumentsDescription
strRequired. The string to be padded. CHAR and VARCHAR both are supported.
lenRequired.
padstrRequired. 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;
  5. +------+----------+-------+-------+
  6. | a | lpad1 | lpad2 | lpad3 |
  7. +------+----------+-------+-------+
  8. | mo | goodgomo | m | NULL |
  9. +------+----------+-------+-------+

Constraints

Currently, MatrixOne doesn’t support select function() without from tables.