The Vertica Forum is getting a makeover! The site will be undergoing maintenance from Tuesday 8/13 to Friday 8/16. We appreciate your patience and cooperation during this time.

How to format a leading zero

When the output type is numeric, Vertica does not print a leading 0. like vsql=> select 0.123 ; ?column? ---------- .123

Comments

  • o print a leading zero use a template as shown below. vsql=> select to_char(0.123,'0.000'); to_char --------- 0.123 (1 row) vsql=> select to_char(.123,'0.000'), to_number('.123','0.999'); to_char | to_number ---------+----------- 0.123 | 0.123 Note: Please see Template Patterns for Numeric Formatting in the SQL Reference Manual

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.