# you've already got your DB handle: my @tables = $db->tables(); foreach my $table (@tables) { my $sql = "select * from $table"; my $sth = $db->prepare( $sql ); $sth->execute(); # check for errors, either set RaiseError or have a "die" clause here print "Structure of $table \n\n"; my $num_fields = $sth->{NUM_OF_FIELDS}; for ( my $i=0; $i< $num_fields; $i++ ) { my $field = $sth->{NAME}->[$i]; my $type = $sth->{TYPE}->[$i]; my $precision = $sth->{PRECISION}->[$i]; # e.g. VARCHAR(50) has a precision of 50 print "Field $field is of type $type, with precision $ precision\n"; } $sth->finish(); }