Closed jean-marc-voillequin closed 4 years ago
You need to set the type of NULL
.
cursor = dbh.parse("insert into dummy values (:1)")
cursor.bind_param(1, nil, String)
cursor.exec
The following is the same with the above except cursor
is closed automatically.
dbh.exec("insert into dummy values (:1)", [nil, String])
Thanks kubo. I can also make a dbh.exec("insert into dummy values (:1)",'') which has the same effect as ''=null in oracle. But why don't you do it automatically? The null case could be managed transparently by oci8? I know that NULL values have a datatype in Oracle, but implicit conversions made by oracle can be usefull here. It could avoid me to have to determine the datatype of the bind variable for a NULL bind variable. Am I wrong?
dbh.exec("insert into dummy values (:1)",'')
works well in Oracle when the datatypes is string, number, date, timestamp and so on. However not all datatypes can be implicitly converted from string. For example object types.
ruby-oci8 (2.2.8 x64-mingw32)