Bugs item #20233, was opened at 2008-05-19 16:47
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=20233&group_id=2014

Category: AR-JDBC
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Gaetano Gallo (locomotyphus)
Assigned to: Nobody (None)
Summary: Special Float values for Oracle

Initial Comment:
Rails generated the following sql which gets rejected by Oracle:

ActiveRecord::ActiveRecordError: ORA-00917: Komma fehlt
: INSERT INTO forms (total_amount, vat, id) VALUES (1E+2.0, 1E+3.0, ?)

This is the definition of our migration:

  create_table :forms do |t|
    t.column :total_amount, :decimal, :precision => 8, :scale => 2
    t.column :vat,          :decimal, :precision => 4, :scale => 2
  end

And here is the test which causes the insertion of a new record to fail:

  def test_create_form_with_special_decimal_values
    form= Form.new do |f|
      f.total_amount= 100.00
      f.vat= 1000.00
    end
    form.save!
  end

For other values like 12.34 or 99.0 this problem does not occure, because they 
get translated in strings recognized by oracle. I think the correct translation 
should happen in the activerecord-jdbc-adapter implementation.

We use a Oracle 10.2.0.1.

Best regards,
Gaetano

----------------------------------------------------------------------

Comment By: Jesse Hu (seizethetime)
Date: 2008-05-20 10:32

Message:
Hi.  please use "INSERT INTO forms (total_amount, vat, id) VALUES (1E+2, 1E+3, 
?)", and 1E+3 is out of precision range defined by  "t.column :vat,          
:decimal, :precision => 4, :scale => 2" ,  precision => 5 should work.

Cheers,
Jesse

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=20233&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to