a =[]
#执行查询操作
cursor = conn.exec('select * from 表名') { |r| a<<r; puts r.join('')}
puts r.join('') 主要是输出样式的问题 可以使用 puts r.to_s
函数用法如下:
1)OCI8.new
OCI8.new(userid, password, dbname = nil, privilege = nil)
connect to Oracle by userid and password. dbname is the connect string of Net8.
If you need DBA privilege, please set privilege as :SYSDBA or :SYSOPER.
If the Oracle client is 10g or later, you can use "//hostname_or_ip:port_no/oracle_sid" as dbname.