# Problem passing parameters to execute sql-query

**URL:** <https://www.ruby-forum.com/t/problem-passing-parameters-to-execute-sql-query/52373>\
**Category:** Ruby\
**Created:** [January 13, 2006, 10:51am UTC](https://www.ruby-forum.com/t/problem-passing-parameters-to-execute-sql-query/52373 "2006-01-13T10:51:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidbe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@davidbe](https://www.ruby-forum.com/u/davidbe)\
**Post date:** [January 13, 2006, 10:51am UTC](https://www.ruby-forum.com/t/problem-passing-parameters-to-execute-sql-query/52373/1 "2006-01-13T10:51:16Z")

</div>

Hi,

I’m using Ruby to manipulate data and store it in a (oracle) database  
(using dbi). One column of the table is a NUMBER(6,2) type – so it  
accepts floating point values.

The SQL-code I want to execute is:  
@sql\_schrijf\_bez = “INSERT INTO TESTUSER.BG\_BEZETTINGSGEGEVENS  
(JAAR, MAAND, IDLOCATIE, WAARDE, OPLAADDATUM)  
VALUES (?, ?, ?, ?, SYSDATE)”

“WAARDE” is the NUMBER(6,2)

When I execute (for example) the next line, I get an ORA-01722-error:  
Invalid number.  
sth\_bez.execute(2005, 2, 1000, 5.9)

When I adjust @sql\_schrijf\_bez to:  
@sql\_schrijf\_bez = “INSERT INTO TESTUSER.BG\_BEZETTINGSGEGEVENS  
(JAAR, MAAND, IDLOCATIE, WAARDE, OPLAADDATUM)  
VALUES (?, ?, ?, 5.9, SYSDATE)”  
^^^^^^^

and

sth\_bez.execute(2005, 2, 1000).

then there’s no problem and the floating point value is stored in the  
database.

Am I missing something? I don’t know what the problem could be… Any  
help is more than welcome!

Thanks in advance,  
David
