Have you tried this: city = DB[table_name].where(field_name.downcase.to_sym => 'NEW YORK')
On Apr 11, 9:06 pm, kdf <[email protected]> wrote: > Hi, > > Is it possible to convert a variable to use as a fieldname in a select > clause ? > > I'm parsing Oracle's data dictionary and would like to select from any > table with a field matching a certain field name > > i.e. field names can be FROM_CITY, CITY, TO_CITY, etc. > > query_tables = DB[:dba_tab_columns].where({:column_name.like('%CITY > %')} & {:owner => 'ME'}) > > for table in query_tables > table_name = table[:table_name] > field_name = table[:column_name] > city = DB[table_name].where(field_name => 'NEW YORK') > puts "#{table_name} - #{city.count}" > end > > I need to convert field_name to a valid field reference. > > Thoughts ? > > Kim -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
