Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 The Oracle LPAD Function      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: LPAD

The Oracle LPAD function pads (adds characters to) the left-side of a string with a given set of characters.

Example Syntax:

LPAD(string, padding_length, [ padding_string ])

The string is the string to prepend or pad characters onto. The padded characters are added to the left-hand side of the string.

The padding_length is the number of characters to return (not the number of characters to add). If the padding_length is smaller than the original string, the LPAD function will truncate the string to the size of the padding_length.

The padding_string is optional. This is the character string that will be padded to the left-hand side of string. If this parameter is omitted, the LPAD function will default to padding space characters to the left-side of the string.

Example Usage:

lpad('Oracle', 10);        would return '    Oracle'
lpad('Oracle', 2); would return 'Or'
lpad('Oracle', 10, 'X'); would return 'XXXXOracle'
lpad('Oracle', 6, 'X'); would return 'Oracle' (no change is made)

Related Links:

Related Code Snippets:
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 13 users online    © 2009 psoug.org
Forgot your password?