LPAD Function - Oracle to MariaDB Migration

In Oracle, the LPAD function returns the string left-padded to the specified number of characters. LPAD accepts 2 or 3 parameters in Oracle.

MariaDB also provides the LPAD function, and since MariaDB 10.3.1 it accepts 2 or 3 parameters, so no conversion is required.

Oracle:

  -- Pad string with blanks (default) 
  SELECT LPAD('abc', 7) FROM dual;
  #        abc
 
  -- Pad string with * 
  SELECT LPAD('abc', 7, '*') FROM dual;
  # ****abc

MariaDB:

  -- Pad string with blanks (default) 
  SELECT LPAD('abc', 7);
  #        abc
 
  -- Pad string with * 
  SELECT LPAD('abc', 7, '*');
  # ****abc

For more information, see Oracle to MariaDB Migration.