467,859 Members | 1,407 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,859 developers. It's quick & easy.

remove $ from money field

Should be a simple question.

When selecting a field that is of type money, how can I remove the $
when selected?

example: $10.00 would return as 10.00

-Robby
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #1
  • viewed: 2207
Share:
3 Replies
On Fri, 2003-08-08 at 20:04, Robby Russell wrote:
Should be a simple question.

When selecting a field that is of type money, how can I remove the $
when selected?

example: $10.00 would return as 10.00


money as a datatype is deprecated, use numeric(9,2) instead (or whatever
precision you need).

Datatypes:
http://developer.postgresql.org/docs...ype-money.html
http://developer.postgresql.org/docs...UMERIC-DECIMAL

Formatting:
http://developer.postgresql.org/docs...ormatting.html

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #2
Robby Russell <rr******@commandprompt.com> writes:
When selecting a field that is of type money, how can I remove the $
when selected?


Actually, almost the only thing money does for you is put in the $ sign
;-). I'd recommend using type numeric instead, if you have any desire
for more flexibility.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #3
As others have said, money is deprecated. I used this function to
migrate some money data once; you could use it to reformat data if you
wanted.

CREATE OR REPLACE FUNCTION x_money(money) RETURNS decimal AS '

set moneydata $1

regsub -all {[,$]} $moneydata {} workable

return $workable

' language 'pltclu';
Robert Treat

On Fri, 2003-08-08 at 20:04, Robby Russell wrote:
Should be a simple question.

When selecting a field that is of type money, how can I remove the $
when selected?

example: $10.00 would return as 10.00

-Robby

--
PostgreSQL :: The Enterprise Open Source Database
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 11 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

24 posts views Thread by Batista, Facundo | last post: by
9 posts views Thread by Ken | last post: by
12 posts views Thread by David Garamond | last post: by
4 posts views Thread by digitalavatar | last post: by
3 posts views Thread by Ghost | last post: by
2 posts views Thread by Alberto | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.