Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita0a9c5b

Browse files
committed
Add example of MONEY casting to numeric if locale is known.
1 parent7888b52 commita0a9c5b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎doc/src/sgml/datatype.sgml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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 $ -->
22

33
<chapter id="datatype">
44
<title id="datatype-title">Data Types</title>
@@ -848,8 +848,14 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
848848
<programlisting>
849849
SELECT 1234::text::money;
850850
</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+
853859
</para>
854860

855861
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp