Legal | Privacy
# fetch_r.rb: Fetch in a more ruby-like way
require 'config.rb'

# Create a connection to Oracle
conn = OCI8.new(DB_USER, DB_PASSWORD, DB_SERVER)

# Fetch and display the rows in a block
nrow = conn.exec("select * from regions") do |r|
	puts r.join(",")
end

# Display count of rows
puts ' '*30 + nrow.to_s + " rows were fetched."

conn.logoff
puts '-'*80

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy