Skip to main content
Known Participant
October 30, 2009
Answered

cfqueryparam, numeric with comma decimal separator problem!

  • October 30, 2009
  • 1 reply
  • 2198 views

Hello everybody,

After spending the hall day and night without finding a solution, I'm turning to the forum for help. As a value for an Insert cfquery I'm using this among others: <cfqueryparam value="#p.PAskPrice#"  cfsqltype="cf_sql_numeric" />,.

The values (p.PAskPrice) come from an xml file which has numbers stored with comma decimal separators (you see, this is Greece - European language) and I get the error Invalid data 0,00 for CFSQLTYPE CF_SQL_NUMERIC. How do I inform the cf_sql_numeric validator that the separator is valid? Any help would be much appreciated.

Thanks in advance,

Yannis

    This topic has been closed for replies.
    Correct answer tooMuchTrouble

    you can't, it's sql. use lsParseNumber on the value you want to insert:

    ]]>

    though i guess to be thorough, try setting the locale (setLocale("el_GR")) on

    that page. pretty sure it won't work but might as well test.

    also for my own curiosity, what is the server's locale?

    1 reply

    tooMuchTroubleCorrect answer
    Inspiring
    October 30, 2009

    you can't, it's sql. use lsParseNumber on the value you want to insert:

    ]]>

    though i guess to be thorough, try setting the locale (setLocale("el_GR")) on

    that page. pretty sure it won't work but might as well test.

    also for my own curiosity, what is the server's locale?

    Known Participant
    October 30, 2009

    Hi Paul,

    1. Thanks for your help.
    2. #GetLocale()# returns el_GR so this is the current locale for the server so I guess that there is no use on setting the locale as you suggested. It is allready the correct one. If you still believe that it would be useful to test this, just let me know.
    3. Due to your suggestion and after some experimentation I ended up using this: <cfqueryparam value="#LSNumberFormat(LSParseNumber("#p.POrof09#"), "____________________")#"  cfsqltype="cf_sql_numeric" /> which quite well solves my problem and I get rid of the decimal which I do not need anyway.
    4. When I first tried this I got the error: gc overhead limit exceeded. I solved this by increasing the Maximum JVM Heap Size (MB) to 1024.

    Now everything is working fine.

    Thanks.

    Yannis.

    Inspiring
    October 30, 2009

    3) doesn't just LSParseNumber() work?

    4) not sure that's related to this (unless the parsing/formatting/parsing).