var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: number conversion to euro
I want to convert a number eg 25 to 0.25 (ie in Euros) in a sql script I'm writing.
I was thinking of using
select convert(value,'ZZZ') from xxx;
but have no idea what ZZZ should be or even if I'm on the right track.
Anybody any ideas?
Re: number conversion to euro
I don't follow. Are you trying to convert cents to Euros (just divide by 100), or convert from one currency to another? The Oracle CONVERT function is for converting text between character sets.
Thanks for your prompt reply.
I'm obviously way off with convert().
We have values of 8,25,250 etc in a table and I would like to return 0.08,0.25,2.50 etc.
Again thanks for your help,
Simplest way is:
SELECT cents_value/100 AS euro_value FROM table;
If you want to be fancy, you could create a function:
CREATE OR REPLACE FUNCTION cents_to_euros( p_cents INTEGER ) RETURN NUMBER IS
RETURN p_cents / 100 ;
SELECT cents_to_euros( cents_value ) AS euro_value FROM table;
Again, thanks for your reply Andrew.
My basic select is:
select totaldebit from table;
If I use:
select totaldebit/100 from table;
Even if I use your function
SELECT cents_to_euros(totaldebit) AS euro_value FROM table
I will get:
But what I'm looking for is the SQL to return values as follows:
Again I thank you for any replies,
This is a display formatting issue. If you are using SQL Plus:
COLUMN euro_value FORMAT 999.99
(put as many 9's before the decimal point as necessary for the largest values to be displayed).
- Tony Andrews
Thanking your kind self Andrew.
Correction: to get 0.01 instead of .01 use the format masK:
COLUMN euro_value FORMAT 990.99