Skip to content

RPAD

Fill a character string to a specified length on the right side with designated characters (spaces by default). If the string is already longer than the specified length, it is truncated on the right side. See also LPAD.

RPAD(string, length [, characters])

For example, add a sequence of zeroes to the right side of the teamid column, for a length of 10 characters:

premdb=# SELECT RPAD(teamid::CHAR(10),10,'0') FROM team;
   rpad    
------------
 1000000000
 2000000000
 3000000000
 4000000000
 5000000000
 6000000000
 7000000000
 8000000000
 9000000000
 1000000000
...

Parent topic:String Functions