Mega Code Archive

 
Categories / PostgreSQL / String Functions
 

Ltrim

postgres=# postgres=# postgres=# CREATE TABLE money_example ( postgres(#             money_cash money, postgres(#             numeric_cash numeric(10,2)); CREATE TABLE postgres=# postgres=# INSERT INTO money_example VALUES ('$12.24', 12.24); INSERT 0 1 postgres=# postgres=# postgres=# SELECT money_cash, '$' || ltrim(to_char(numeric_cash, '9999.99')) postgres-#        AS numeric_cashified postgres-#        FROM money_example;  money_cash | numeric_cashified ------------+-------------------      $12.24 | $12.24 (1 row) postgres=# postgres=# drop table money_example; DROP TABLE postgres=#