tech on the net
Home About Us Feedback Site Map


Access Excel Word


SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker


C Language


ASCII Table Linux UNIX Java Clipart Joke of the Moment
Share this page:

Oracle/PLSQL: LPAD Function

Learn how to use the Oracle/PLSQL LPAD function with syntax and examples.


The Oracle/PLSQL LPAD function pads the left-side of a string with a specific set of characters (when string1 is not null).


The syntax for the Oracle/PLSQL LPAD function is:

LPAD( string1, padded_length, [ pad_string ] )

Parameters or Arguments

string1 is the string to pad characters to (the left-hand side).

padded_length is the number of characters to return. If the padded_length is smaller than the original string, the LPAD function will truncate the string to the size of padded_length.

pad_string is optional. This is the string that will be padded to the left-hand side of string1. If this parameter is omitted, the LPAD function will pad spaces to the left-side of string1.

Applies To

The LPAD function can be used in the following versions of Oracle/PLSQL:

  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i


Let's look at some Oracle LPAD function examples and explore how to use the LPAD function in Oracle/PLSQL.

For example:

LPAD('tech', 7); would return '   tech'
LPAD('tech', 2); would return 'te'
LPAD('tech', 8, '0'); would return '0000tech'
LPAD('tech on the net', 15, 'z'); would return 'tech on the net'
LPAD('tech on the net', 16, 'z'); would return 'ztech on the net'