[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

problem passing parameters to execute sql-query

David Jacobs

1/13/2006 9:44:00 AM

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

1 Answer

David Jacobs

1/16/2006 1:13:00 PM

0

Has not anyone any clue how I can find a solution for this problem?

Kind regards,
David

> 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