René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Ruby dbi, prepare and select

require 'dbi'

dbh = DBI.connect('DBI:Oracle:sid', 'user', 'password')

sth = dbh.prepare('select table_name, tablespace_name from user_tables 
                   where table_name like ?')

sth.execute('A%')

while row=sth.fetch do
  printf("%30s %30s\n", row[0], row[1])
end

sth.execute('B%')

while row=sth.fetch do
  printf("%30s %30s\n", row[0], row[1])
end