US and Worldwide: +1 (866) 660-7555
Results 1 to 3 of 3

Thread: Problem reading MySql Float

  1. #1

    Default Problem reading MySql Float

    Hi guys.
    I´m facing a problem in my kettle extract.... I´m extracting values from a MySql database. 1 of the fields is a float. The problem is that wen i use kettle to extract data from the original database, but wen i take a float like 2.5, it only place the value 2 on the target table. Both fields are float, and kettle recognize the 2.5 value as 2,5. The swap from "." to "," bring problems with the data too.
    Can someone help plz?
    How can i extract a float value from a mysql table and place it in another mysql table, without swapping 2.5 to 2,5?
    Thanks

  2. #2
    Join Date
    Nov 1999
    Posts
    9,535

    Default

    Helder,

    Numbers are numbers, they don't contain dots, commas or spaces, only their String representation does.
    So Kettle representing the number as "2,5" during preview is simply because in Portugal the default decimal symbol is a comma.

    Remember, there is only 1 (one) situation where Kettle will do automatic rounding and that is while populating a target database when you have a certain length and precision set on a Number (or BigNumber) column.

    For the truncation problem check the data type of the target table as well as the precision of the input column.

    Matt
    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

  3. #3

    Default

    Hi, and thanks for the help.
    Sorry for only being posting now but i had a hard time finding the problem ^^.
    The main problem is that, as you said, Portuguese version of float place a "," instead of a ".". Therefor, wen i was using a insert statement like INSERT...(?), i wanted to have something like INSERT...(2.5), but what i really had was INSERT...(2,5), and then i got a sql error saying i had more values than columns.
    I already solved the problem, i use a cast to char at the select statement, so then, wen i do the insert statement i can do INSERT...(cast('?' as DECIMAL(6,2))), and then it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •