How to handle "currency" in Vertica

Moderator: NorbertKrupa

adrian.oprea
Intermediate
Intermediate
Posts: 163
Joined: Tue Jun 19, 2012 2:44 pm
Location: Rio de Janeiro
Contact:

Re: How to handle "currency" in Vertica

Post by adrian.oprea » Wed Sep 05, 2012 1:20 pm

Thank you "SKWA" and "SCUTTER" for the effort in helping me !!
trying so hard !!!

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: How to handle "currency" in Vertica

Post by id10t » Wed Sep 05, 2012 2:10 pm

Hi!

>> shouldn't this be already in Vertica by default ?
May be, but take in account that main goal of Vertica is analytics and NOT! data representation. Data should be represented by BI tools and them must have such ability.

sarah
Intermediate
Intermediate
Posts: 77
Joined: Mon Aug 27, 2012 1:34 pm

Re: How to handle "currency" in Vertica

Post by sarah » Wed Sep 12, 2012 3:06 pm

Could you use the translate function when you want to display the data?

Code: Select all

dbadmin=> SELECT translate(to_char(123456.77,'R$ 999G999G999D99'), ',.', '.,');
     translate
--------------------
 R$      123.456,77
(1 row)
Have a GREAT day!

adrian.oprea
Intermediate
Intermediate
Posts: 163
Joined: Tue Jun 19, 2012 2:44 pm
Location: Rio de Janeiro
Contact:

Re: How to handle "currency" in Vertica

Post by adrian.oprea » Wed Sep 12, 2012 3:43 pm

Wow , that was it !!

Thx
IOY :) :o
trying so hard !!!

adrian.oprea
Intermediate
Intermediate
Posts: 163
Joined: Tue Jun 19, 2012 2:44 pm
Location: Rio de Janeiro
Contact:

Re: How to handle "currency" in Vertica

Post by adrian.oprea » Wed Sep 19, 2012 9:14 pm

Even a better solution is :
Set the locale: (if more than one node, set this in the .profile, .bashrc of the dbadmin user, or just set it as the system wide locale)

Code: Select all

export LC_ALL=pt_BR.UTF-8
Start Vertica.
On vsql:
dbadmin=> SELECT TO_CHAR(12343148.56, 'L999G999G999G999D99');
          TO_CHAR          
---------------------------
 R$      12.343.148,56
(1 row)
Thank you Carlos,
PS more detailes on this on page "Set the Host Locale (Language)" in the online documentation at vertica site !!

How could i miss this !! OMG :mrgreen:
trying so hard !!!

scutter
Master
Master
Posts: 302
Joined: Tue Aug 07, 2012 2:15 am

Re: How to handle "currency" in Vertica

Post by scutter » Thu Sep 20, 2012 3:33 am

Glad you resolved this. I thought you were trying to convert between mulitple currencies, not just display in a single local currency.
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC

adrian.oprea
Intermediate
Intermediate
Posts: 163
Joined: Tue Jun 19, 2012 2:44 pm
Location: Rio de Janeiro
Contact:

Re: How to handle "currency" in Vertica

Post by adrian.oprea » Thu Sep 20, 2012 1:30 pm

scutter wrote:Glad you resolved this. I thought you were trying to convert between mulitple currencies, not just display in a single local currency.
I think i need to improve the way i put things in English :).
Thx ALL
trying so hard !!!

Post Reply

Return to “Vertica Database Administration”