Selects are basically "get information out". Following the Perl tradition, there's more than one way to do it. For example:
my $empty_column_desc = $dbh->selectall_arrayref(qq{ select table_name, column_name from mjr_cat_ext_table_det where column_description is null }); my %empty_columns; for (@$empty_column_desc) { my ($t, $c) = @$_; $empty_columns{$t}{$c} = 1; }
You can also just fetch one row:
print $dbh->selectrow_array(qq{ select 1 + 1 from dual });
Or fetch into a hash:
$dbh = DBI->connect('dbi:SQLite:data.db', { 'FetchHashKeyName' => 'NAME_lc' }); $weeks = $dbh->selectall_hashref(qq{ select week, sum(hours * prob) weighted_prob from work }, 'week'); for (sort keys %$weeks) { print "Week $_ -> " . $weeks->{$_}->{weighted_prob} . "\n"; }