Left Padding - Adds spaces or zeros at the start of the string in Teradata

Left Padding function is not readily available in Teradata but it can be acheived by computing the padding characters by substring function and adding them to the input string or column.

Sample Syntax:
SELECT 
SUBSTRING('characters to pad',1, length of characters to pad -LENGTH('string' or column))  || 'string' or column


Example:

Suppose we want to pad for a number 12 upto 5 characters(total) with zeros.
12 ------> 00012

SELECT 
'12' AS inputvalue, 
SUBSTRING('00000',1,5-LENGTH('12'))  || inputvalue AS after_padding

Remember, the number must be given as a string (should be in quotes)
Output:
inputvalueafter_padding
1200012


Suppose we want to pad for a string 'aa' upto 5 characters with zeros.
aa ------> 000aa

SELECT 
'aa' AS inputvalue, 
SUBSTRING('00000',1,5-LENGTH('aa'))  || inputvalue AS after_padding


Output:
inputvalueafter_padding
aa000aa