Need help on calling the column_name while iterating the table via oracle db

Hi there,

I am trying to get the value from the table(employee)connecting through
the oracle database. Since there are 100s of values, i would need to
iterate the table and get the exact value.

I have the code that works if i use the index no. such as row[1] but i
wanted to use the column_name “first name” instead of row[1]. Below is
the code that i have
which works.

require ‘rubygems’
require ‘oci8’

$connection = OCI8.new(‘usrname’, ‘password’, ‘//hostname:portno/sid’)
person=$connection.exec(“SELECT * from Employee”) do |row|
puts “#{row[1]}”
end

I get the result succesfully but i want to get the result not with
row[1] but with the row with the respective column_name.

Can anybody help me on this? Any little bit of help would be highly
appreciated.

Thanks

Ash

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs