class OCI8::BindType::DateTime
# => a DateTime.
cursor.exec
cursor.bind_param(:ts, nil, DateTime)
cursor = conn.exec(“BEGIN :ts := current_timestamp; END”)<br><br>DateTime.
The output value of the bind varible is always a
utc_offset- -12*3600 <= utc_offset <= 24*3600 [-12:00 to +14:00]
offset - (-12.to_r / 24) to (14.to_r / 24) [-12:00 to +14:00]
sec_fraction - 0 to (999_999_999.to_r / (24*60*60* 1_000_000_000)) [999,999,999 nanoseconds]
sec - 0 to 59
min - 0 to 59
hour - 0 to 23
mday (or day) - 0 to 31 [depends on the month]
mon (or month) - 0 to 12
year -
-4712 to 9999 [excluding year 0]
The acceptable value are listed below.
zone is used.
utc_offset, it is used for time zone. If not, the session time
If not, zeros are set. If the object responses to offset or
minute, second or fraction of a second respectively.
sec or sec_fraction, the responsed values are used for hour,
and mday (or day). If the object responses to hour, min,
which has at least three instance methods year, mon (or month)
On setting a object to the bind variable, you can use any object<br><br>cursor.close<br>end<br>cursor.exec<br>cursor = landing_time<br>cursor = ship_name
].each do |ship_name, landing_time|
[‘Apollo 17’, DateTime.parse(‘1972-12-11 19:54:57 00:00’))]
[‘Apollo 16’, DateTime.parse(‘1972-04-21 02:23:35 00:00’))],
[‘Apollo 15’, DateTime.parse(‘1971-07-30 22:16:29 00:00’))],
[‘Apollo 14’, DateTime.parse(‘1971-02-05 09:18:11 00:00’))],
[‘Apollo 12’, DateTime.parse(‘1969-11-19 06:54:35 00:00’))],
[[‘Apollo 11’, DateTime.parse(‘1969-07-20 20:17:40 00:00’))],
cursor.bind_param(‘:2’, nil, DateTime)
cursor.bind_param(‘:1’, nil, String, 60)
cursor = conn.exec(“INSERT INTO lunar_landings(ship_name, landing_time) VALUES(:1, :2)”)
To bind explicitly:
The bind variable:2
is bound asTIMESTAMP WITH TIME ZONE
on Oracle.
DateTime.parse(‘1969-7-20 20:17:40 00:00’))
‘Apollo 11’,
conn.exec(“INSERT INTO lunar_landings(ship_name, landing_time) VALUES(:1, :2)”,
value implicitly:
To bind a DateTime[http://www.ruby-doc.org/core/classes/DateTime.html]
== Bind
ALTER SESSION SET TIME_ZONE=‘-05:00’
You can change the session time zone by executing the following SQL.
time zone by default.
have time zone information. The session time zone is the client machine’s
The time zone part is a session time zone if the Oracle datatype doesn’t
is a DateTime.
TIME ZONE</tt> orTIMESTAMP WITH LOCAL TIME ZONE
column
The fetched value for aDATE
,TIMESTAMP
,TIMESTAMP WITH<br><br>== Select<br><br>object as Oracle's <tt>TIMESTAMP WITH TIME ZONE
datatype.
DateTime[http://www.ruby-doc.org/core/classes/DateTime.html]
This is a helper class to bind ruby’s
++
OCI8::BindType::DateTime
–
- 0 to 12
- 0 to 31 [depends on the month]
- 0 to 23
- 0 to 59
- 0 to 59
- 0 to (999_999_999.to_r / (24*60*60* 1_000_000_000)) [999,999,999 nanoseconds]
- (-12.to_r / 24) to (14.to_r / 24) [-12:00 to +14:00]
- -12*3600 <= utc_offset <= 24*3600 [-12:00 to +14:00]
def self.create(con, val, param, max_array_size)
def self.create(con, val, param, max_array_size) if true # TODO: check Oracle server version DateTimeViaOCITimestamp.new(con, val, param, max_array_size) else DateTimeViaOCIDate.new(con, val, param, max_array_size) end end
def self.create(con, val, param, max_array_size)
def self.create(con, val, param, max_array_size) DateTimeViaOCIDate.new(con, val, param, max_array_size) end