From: "Mitja Čebokli" Date: 2010-04-16T19:56:19+09:00 Subject: DB to CSV Hello, i am very new to ruby and i have a major problem i would like to have some help on... I would like to execute a query on a database and export the values to the CSV file. I have tried many different ways and i can't get it to work. This is what i have so far: require 'oci8' require 'csv' time = Time.now rows =[] connection = OCI8.new("user", "pass", "srv") dataset = connection.exec("select column from table") while r = dataset.fetch() rows << r.join("\n") end dataset.close connection.logoff CSV.open("c:\\Temp\\test_"+time.strftime("%d-%m-%Y_%H-%M")+".csv","w",:col_sep => ";") do |csv| rows.each do |row| csv << row end end I am getting this error: csv.rb:1700 undefined method 'map' What i want to achieve is pretty simple: - have a header with names of columns from the database (automatic) - write a CSV file with each record as a new line - have a semicolon as a seperator Thanks for any info on this. BTW: no RAILS! -- Posted via http://www.ruby-forum.com/.