opentextguptateamdevelopersqlbasecenturalpad

SQLBase: is there a lpad function?


I am using SQLBase and I have to complete a column with zeros.

This example works in PostgreSQL. I need to do the same in SQLBase but there isn't a function like lpad.

SELECT lpad(last_name, 10, '0')
FROM persons;

If last_name is Douglas, the result is:

000Douglas

Is there a way to define a function that can do the same as lpad?


Solution

  • Select @REPEAT('0', 10 - @LENGTH(Last_Name) ) || Last_Name