|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.219 2007/11/2706:05:57 momjian Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.220 2007/11/2716:46:36 momjian Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="datatype">
|
4 | 4 | <title id="datatype-title">Data Types</title>
|
@@ -848,8 +848,14 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
|
848 | 848 | <programlisting>
|
849 | 849 | SELECT 1234::text::money;
|
850 | 850 | </programlisting>
|
851 |
| - There is no simple way of doing the reverse using a locale-neutral |
852 |
| - method, namely casting a <type>money</type> value to a numeric type. |
| 851 | + There is no simple way of doing the reverse in a locale-independent |
| 852 | + manner, namely casting a <type>money</type> value to a numeric type. |
| 853 | + If you know the currency symbol and thousands separator you can use |
| 854 | + <function>regexp_replace()</>: |
| 855 | +<programlisting> |
| 856 | +SELECT regexp_replace('52093.89'::money::text, '[$,]', '', 'g')::numeric; |
| 857 | +</programlisting> |
| 858 | + |
853 | 859 | </para>
|
854 | 860 |
|
855 | 861 | <para>
|
|