| Message: 95565 |
 |
BY: Brian Ploetz (bploetz) DATE: 2010-12-20 14:00 SUBJECT: RE: Exception with DATE columns in Oracle 11g Hi Kubo,
The script fails for me with the same error I was seeing in my app. Here's the result:
$ gem list
*** LOCAL GEMS ***
bundler (1.0.7)
rake (0.8.7)
ruby-oci8 (2.0.4)
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
$ irb
ruby-1.9.2-p0 > gem 'ruby-oci8'
=> true
ruby-1.9.2-p0 > require 'oci8'
=> true
ruby-1.9.2-p0 > conn = OCI8.new "XXX", "XXX", "XXX"
=> #<OCI8:XXX>
ruby-1.9.2-p0 > puts "Client Version: #{OCI8.oracle_client_version}"
Client Version: 11.2.0.2.0
=> nil
ruby-1.9.2-p0 > puts "Server Version: #{conn.oracle_server_version}"
Server Version: 11.2.0.1.0
=> nil
ruby-1.9.2-p0 > puts "ENV['TZ'] : #{ENV['TZ']}"
ENV['TZ'] :
=> nil
ruby-1.9.2-p0 > conn.exec 'drop table test_date purge' rescue nil
=> nil
ruby-1.9.2-p0 > conn.exec 'create table test_date (dt date)'
=> 0
ruby-1.9.2-p0 > conn.exec 'insert into test_date values (sysdate)'
=> 1
ruby-1.9.2-p0 > conn.commit
=> #<OCI8:XXX>
ruby-1.9.2-p0 > print 'before alter session: '
before alter session: => nil
ruby-1.9.2-p0 > p conn.select_one 'select * from test_date' rescue p $!
[2010-12-20 07:47:47 -0600]
=> [2010-12-20 07:47:47 -0600]
ruby-1.9.2-p0 > conn.exec "alter session set time_zone = 'US/Eastern'"
=> 0
ruby-1.9.2-p0 > print 'after alter session: '
after alter session: => nil
ruby-1.9.2-p0 > p conn.select_one 'select * from test_date' rescue p $!
#<NoMethodError: undefined method `*' for nil:NilClass>
=> #<NoMethodError: undefined method `*' for nil:NilClass>
ruby-1.9.2-p0 > conn.logoff
=> true
I can't easily change that C file and re-compile unfortunately, as I don't have control over the server. I'll see if I can get our sysadmin to do that..... | |