def find(schema, table)
      if schema.select_first(
        "SELECT table_name FROM all_tables
        WHERE owner = :owner
          AND table_name = :table_name",
            schema.schema_name, table.to_s.upcase)
        new(schema, table)
      # search for synonym
      elsif (row = schema.select_first(
        "SELECT t.owner, t.table_name
        FROM all_synonyms s, all_tables t
        WHERE s.owner = :owner
          AND s.synonym_name = :synonym_name
          AND t.owner = s.table_owner
          AND t.table_name = s.table_name
        UNION ALL
        SELECT t.owner, t.table_name
        FROM all_synonyms s, all_tables t
        WHERE s.owner = 'PUBLIC'
          AND s.synonym_name = :synonym_name
          AND t.owner = s.table_owner
          AND t.table_name = s.table_name",
            schema.schema_name, table.to_s.upcase, table.to_s.upcase))
        new(schema, row[1], row[0])
      else
        nil
      end
    end
def find(schema, table)
      if schema.select_first(
        "SELECT table_name FROM all_tables
        WHERE owner = :owner
          AND table_name = :table_name",
            schema.schema_name, table.to_s.upcase)
        new(schema, table)
      # search for synonym
      elsif (row = schema.select_first(
        "SELECT t.owner, t.table_name
        FROM all_synonyms s, all_tables t
        WHERE s.owner = :owner
          AND s.synonym_name = :synonym_name
          AND t.owner = s.table_owner
          AND t.table_name = s.table_name
        UNION ALL
        SELECT t.owner, t.table_name
        FROM all_synonyms s, all_tables t
        WHERE s.owner = 'PUBLIC'
          AND s.synonym_name = :synonym_name
          AND t.owner = s.table_owner
          AND t.table_name = s.table_name",
            schema.schema_name, table.to_s.upcase, table.to_s.upcase))
        new(schema, row[1], row[0])
      else
        nil
      end
    end
:nodoc: