LPAD()

Description of lpad.eps follows

Purpose

  • The LPAD function inserts padding to the left of a string.
  • Useful for formatting the output of a query

–LPAD inserts padding tot he left of a string. it takes 3 arguments, string, lenth of the string and the padding string
SELECT LPAD(‘Good’, 15, ‘?’)
FROM DUAL;

 

— RPAD inserts padding to the right of a string
SELECT RPAD(‘Good’, 15, ‘?’)
FROM DUAL;

LPAD(‘GOOD’,15,
—————
???????????Good

RPAD(‘GOOD’,15,
—————
Good???????????

 

documentation

https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/LPAD.html

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top