| Message: 95548 |
 |
BY: Kubo Takehiro (kubo) DATE: 2010-12-19 05:27 SUBJECT: RE: Exception with DATE columns in Oracle 11g 1. Does the following script work for you? It works fine for me.
-----------------------
gem 'ruby-oci8'
require 'oci8'
conn = OCI8.new 'ruby/oci8' # Change This Line!
puts "Client Version: #{OCI8.oracle_client_version}"
puts "Server Version: #{conn.oracle_server_version}"
puts "ENV['TZ'] : #{ENV['TZ']}"
conn.exec 'drop table test_date purge' rescue nil
conn.exec 'create table test_date (dt date)'
conn.exec 'insert into test_date values (sysdate)'
conn.commit
print 'before alter session: '
p conn.select_one 'select * from test_date' rescue p $!
conn.exec "alter session set time_zone = 'US/Eastern'"
print 'after alter session: '
p conn.select_one 'select * from test_date' rescue p $!
conn.logoff
-----------------------
2. Could you change ext/ocidatetime.c near line 122 as follows and test again? I want to know the error message of OCIDateTimeGetTimeZoneOffset.
-----------------------
rv = OCIDateTimeGetTimeZoneOffset(oci8_envhp, oci8_errhp, dttm, &tz_hour, &tz_minute);
if (rv != OCI_SUCCESS) oci8_raise(oci8_errhp, rv, NULL); /* ADD THIS LINE. */
have_tz = (rv == OCI_SUCCESS);
-----------------------
| |