Home > other >  how to write lpad function in PostgreSQL
how to write lpad function in PostgreSQL

Time:07-20

I'm converting oracle to PostgreSQL. While converting for this below line

P_OTP := LPAD(W_OTPNUM, 6, '0');

I'm getting error like function lpad(integer, integer, unknown) does not exist. Please help me to solve this error

CodePudding user response:

W_OTPNUM seems to be a number. You cannot pad a number, only a string.

LPAD(W_OTPNUM::TEXT, 6, '0')
  • Related