$tab_g = $dbh->prepare(qq{ select table_name, HIGH_LEVEL_DESCRIPTION from mjr_cat_ext_table_sum where high_level_description is not null and table_name = ? }); $tab_g->execute("WINNIE"); while (($t, $d) = $tab_g->fetchrow_array) { $d=~s/'/''/g; $dbh->do(qq{comment on table sd.$t is '$d'}); }