From: "Berge, Robert" Date: 2002-08-14T07:54:07+09:00 Subject: DBI Error when attempting to pass Oracle's SYSDATE to a place hol der This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C2431C.4DD75C60 Content-Type: text/plain I'm using Ruby 1.6.7, Ruby/dbi .15 and I'm trying to call an Oracle stored proc where the third parameter is of DATE type. I want to pass in the current date & time by using SYSDATE. If I do the following everything works as it should. dbh.do( "BEGIN SOME_PROC( 1, 1, SYSDATE ); END" ) However, if I try to use place holders as below sql = "BEGIN SOME_PROC( ?, ?, ? ); END" dbh.do( sql, 1, 1, SYSDATE ) Oracle returns an error because of the SYSDATE value. Even putting quotes around SYSDATE doesn't do any good. Using similar code I get the same error using perl. Even doing the following works: Dbh.do( sql, 1, 1, "#{Time.new.strftime( \"%d-%b-%Y\" ) }" ) Does work. Has anyone else seen this error? Is this an error in DBI or in Oracle? Is there a way to work around this problem in the current environment? Bob Berge ------_=_NextPart_001_01C2431C.4DD75C60 Content-Type: text/html Content-Transfer-Encoding: quoted-printable

I'm using Ruby 1.6.7, Ruby/dbi =  .15 and I'm trying to = call an Oracle stored proc where the third parameter is of DATE type.  I want to pass in the current = date & time by using SYSDATE.  If = I do the following everything works as it should.

dbh.do( "BEGIN SOME_PROC( 1, 1, SYSDATE ); END" )

 

However, if I try to use place holders as = below

sql =3D "BEGIN SOME_PROC( ?, ?, ? ); END"

dbh.do( sql, 1, 1, SYSDATE )

 

Oracle returns an error because of the SYSDATE = value.  Even putting quotes around = SYSDATE doesn't do any good.  Using = similar code I get the same error using perl.

 

Even doing the following = works:

Dbh.do( sql, 1, 1, = "#{Time.new.strftime( \"%d-%b-%Y\" ) }" )   Does work. =

 

Has anyone else seen this error?  Is this an error in DBI or in = Oracle?  Is there a way to work around = this problem in the current environment?

 

Bob Berge

------_=_NextPart_001_01C2431C.4DD75C60--