[pi-code-cleaning] Casting added to to_number function
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Wed, 27 Apr 2016 15:31:16 +0200
changeset 29518 bd9bd3be41a7
parent 29517 9f7d593832a5
child 29519 5db864df49d0
[pi-code-cleaning] Casting added to to_number function

A casting to convert a string variable to numeric has been added
in the "to_number" function.
src-db/database/model/prescript-PostgreSql.sql
--- a/src-db/database/model/prescript-PostgreSql.sql	Wed Apr 27 14:44:37 2016 +0200
+++ b/src-db/database/model/prescript-PostgreSql.sql	Wed Apr 27 15:31:16 2016 +0200
@@ -176,8 +176,8 @@
     -- this is the old behaviour
     RETURN to_number($1, ''S99999999999999D999999'');
   ELSE
-    v_Mant := substring($1 from 1 for v_Pos - 1); -- Mantissa, implicit cast to data type NUMERIC
-    v_Exp := substring($1 from v_Pos + 1); -- Exponent, implicit cast to data type NUMERIC
+    v_Mant := cast(substring($1 from 1 for v_Pos - 1) as numeric);
+    v_Exp := cast(substring($1 from v_Pos + 1) as numeric);
     v_Res := v_Mant * power(10, v_Exp);
     RETURN v_Res;
   END IF;