class Sequel::IBMDB::Database

def table_exists?(name)

error that indicates it should be REORGed.
of it. This REORGs automatically if the database raises a specific
On DB2, a table might need to be REORGed if you are testing existence
def table_exists?(name)
  v ||= false # only retry once
  sch, table_name = schema_and_table(name)
  name = SQL::QualifiedIdentifier.new(sch, table_name) if sch
  from(name).first
  true
rescue DatabaseError => e
  if e.to_s =~ /Operation not allowed for reason code "7" on table/ && v == false
    # table probably needs reorg
    reorg(name)
    v = true
    retry 
  end
  false
end