[R] ROracle - ORA-02005: implicit (-1) length not valid for this bind or define datatype

Ramon Martínez Coscollà
Mon, 09 Feb 2009 20:25:17 -0000

Hi all!!

I would like to know if anyone has experienced this behaviour with
ROracle package. I'm attaching information to reproduce the issue.

Bug maybe?

Thank you very much for your attention.

Ramon.

##################################################################
##################################################################
 oraExecStatement   BUG   :  RS-DBI driver: (ORA-02005: implicit (-1)
length not valid for this bind or define datatype
##################################################################
##################################################################

> library(ROracle)
Loading required package: DBI
>
> ora <- dbDriver("Oracle")
>
> con <- dbConnect(ora, user = "uuuuu", password =
"pppp" , dbname = "dddd")
>
> dafra01 <-
data.frame(N1=rep(c(10),10),C1=rep(c("11"),10),N2=rep(c(12),10),stringsAsFactors=FALSE)
>
> ps <-   oraPrepareStatement(con=con, statement="insert into tmp_r
(N1,C1,N2)  values(:1,:2,:3)", bind=
c("numeric","character","numeric"))
>
> oraDescribePreparedStatement(ps)
<OraPreparedStatement:(24060,0,0)>
 Statement: insert into tmp_r (N1,C1,N2)  values(:1,:2,:3)
 Has completed? no
 Affected rows: -1
 Rows fetched: -1

> oraPreparedStatementInfo(ps)
$statement
[1] "insert into tmp_r (N1,C1,N2)  values(:1,:2,:3)"

$isSelect
[1] 0

$rowsAffected
[1] -1

$rowCount
[1] -1

$completed
[1] -1

$fields
$fields[[1]]
NULL


$boundParams
 parameter columnNum    Sclass
1         1         1    double
2         2         2 character
3         3         3    double

> oraBoundParamsInfo(ps)
 parameter columnNum    Sclass
1         1         1    double
2         2         2 character
3         3         3    double
>
> oraExecStatement(ps=ps, data=dafra01)
Error in oraExecStatement(ps = ps, data = dafra01) :
 RS-DBI driver: (ORA-02005: implicit (-1) length not valid for this
bind or define datatype
)
>



##################################################################
##################################################################
       Oracle version  and  table
##################################################################
##################################################################

bash-3.2$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 9 10:55:45 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> describe tmp_r
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 N1                                                 NUMBER
 C1                                                 CHAR(4)
 N2                                                 NUMBER

SQL>



##################################################################
##################################################################
       Operating System: Red Hat Enterprise Linux 5
##################################################################
##################################################################
bash-3.2$ uname -a
Linux prod 2.6.18-92.1.22.el5 #1 SMP Fri Dec 5 09:28:22 EST 2008
x86_64 x86_64 x86_64 GNU/Linux



##################################################################
##################################################################
       R version
##################################################################
##################################################################
#  From  http://cran.at.r-project.org/bin/linux/redhat/el5/x86_64/

bash-3.2$ R

R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> version
              _
platform       x86_64-redhat-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          2
minor          8.0
year           2008
month          10
day            20
svn rev        46754
language       R
version.string R version 2.8.0 (2008-10-20)


 .Machine

$double.eps
[1] 2.220446e-16

$double.neg.eps
[1] 1.110223e-16

$double.xmin
[1] 2.225074e-308

$double.xmax
[1] 1.797693e+308

$double.base
[1] 2

$double.digits
[1] 53

$double.rounding
[1] 5

$double.guard
[1] 0

$double.ulp.digits
[1] -52

$double.neg.ulp.digits
[1] -53

$double.exponent
[1] 11

$double.min.exp
[1] -1022

$double.max.exp
[1] 1024

$integer.max
[1] 2147483647

$sizeof.long
[1] 8

$sizeof.longlong
[1] 8

$sizeof.longdouble
[1] 16

$sizeof.pointer
[1] 8



##################################################################
##################################################################
       ROracle
##################################################################
##################################################################

> install.packages("ROracle", configure.arg
="--enable-extralibs=-lsqlplus ")

--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL
'http://cran.at.r-project.org/src/contrib/ROracle_0.5-9.tar.gz'
Content type 'application/x-gzip' length 155808 bytes (152 Kb)
opened URL
=================================================downloaded 152 Kb

* Installing *source* package 'ROracle' ...
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/Makefile
** libs
** arch -
R CMD COMPILE RS-DBI.c
make[1]: Entering directory `/tmp/R.INSTALL.T23031/ROracle/src'
gcc -I/usr/lib64/R/include -DRS_ORA_SQLGLS_WORKAROUND
-I/usr/local/include    -fpic  -O3 -g -std=gnu99 -c RS-DBI.c -o
RS-DBI.o
RS-DBI.c: In function 'RS_DBI_makeSQLNames':
RS-DBI.c:1175: warning: assignment discards qualifiers from pointer target type
RS-DBI.c:1188: warning: implicit declaration of function 'isalpha'
RS-DBI.c: In function 'RS_na_set':
RS-DBI.c:1226: warning: assignment discards qualifiers from pointer target type
make[1]: Leaving directory `/tmp/R.INSTALL.T23031/ROracle/src'
proc CODE=ANSI_C MODE=ORACLE INCLUDE=/usr/lib64/R/include \
               PARSE=NONE LINES=false PREFETCH=1 RS-Oracle.pc

Pro*C/C++: Release 10.2.0.1.0 - Production on Fri Jan 9 10:50:43 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

System default option values taken from:
/opt/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg

R CMD COMPILE RS-Oracle.c
make[1]: Entering directory `/tmp/R.INSTALL.T23031/ROracle/src'
gcc -I/usr/lib64/R/include -DRS_ORA_SQLGLS_WORKAROUND
-I/usr/local/include    -fpic  -O3 -g -std=gnu99 -c RS-Oracle.c -o
RS-Oracle.o
RS-Oracle.c: In function 'RS_Ora_prepareStatement':
RS-Oracle.c:2382: warning: implicit declaration of function 'isalpha'
RS-Oracle.c:2383: warning: implicit declaration of function 'toupper'
RS-Oracle.c:2385: warning: implicit declaration of function 'isgraph'
RS-Oracle.c: In function 'RS_Ora_setSToOraMappings':
RS-Oracle.c:4673: warning: implicit declaration of function 'isdigit'
RS-Oracle.c: In function 'RS_Ora_cpyDataFrameToOra':
RS-Oracle.c:4849: warning: assignment discards qualifiers from pointer
target type
RS-Oracle.c: In function 'RS_SclassNames_To_StypeIds':
RS-Oracle.c:6569: warning: assignment discards qualifiers from pointer
target type
make[1]: Leaving directory `/tmp/R.INSTALL.T23031/ROracle/src'
R CMD SHLIB -o ROracle.so RS-DBI.o RS-Oracle.o
make[1]: Entering directory `/tmp/R.INSTALL.T23031/ROracle/src'
gcc -shared -Bdirect,--hash-stype=both,-Wl,-O1 -o ROracle.so RS-DBI.o
RS-Oracle.o -L/opt/oracle/product/10.2.0/db_1/lib
-L/opt/oracle/product/10.2.0/db_1/network/lib -lclntst10 -lnbeq10
-lnhost10 -lnus10 -lnldap10 -lldapclnt10 -lnsslb10 -lntcp10 -lntcps10
-lnsslb10 -lntcp10 -lntns10 -ldl -lm -lpthread -lnsl -lirc -ldl -lm
-lsqlplus  -L/usr/lib64/R/lib -lR
make[1]: Leaving directory `/tmp/R.INSTALL.T23031/ROracle/src'
** R
** inst
** preparing package for lazy loading
Loading required package: DBI
Creating a new generic function for "format" in "ROracle"
Creating a new generic function for "print" in "ROracle"
** help
 >>> Building/Updating help pages for package 'ROracle'
    Formats: text html latex example
 DBIPreparedStatement-class        text    html    latex   example
 OraConnection-class               text    html    latex   example
 OraDriver-class                   text    html    latex   example
 OraObject-class                   text    html    latex   example
 OraPreparedStatement-class        text    html    latex   example
 OraResult-class                   text    html    latex   example
 Oracle                            text    html    latex   example
 S4R                               text    html    latex
 dbCallProc-methods                text    html    latex
 dbCommit-methods                  text    html    latex   example
 dbConnect-methods                 text    html    latex   example
 dbDataType-methods                text    html    latex   example
 dbDriver-methods                  text    html    latex   example
 dbGetInfo-methods                 text    html    latex   example
 dbListTables-methods              text    html    latex   example
 dbObjectId-class                  text    html    latex   example
 dbPrepareStatement-methods        text    html    latex   example
 dbReadTable-methods               text    html    latex   example
 dbSendQuery-methods               text    html    latex   example
 dbSetDataMappings-methods         text    html    latex   example
 fetch-methods                     text    html    latex   example
 isIdCurrent                       text    html    latex   example
 make.db.names-methods             text    html    latex   example
 oraParseConParams                 text    html    latex   example
 oraSupport                        text    html    latex
 safe.write                        text    html    latex   example
 summary-methods                   text    html    latex
** building package indices ...
* DONE (ROracle)

The downloaded packages are in
       /tmp/RtmpjksTjG/downloaded_packages