kenguy has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; use DBI; my $dbh = DBI->connect('dbi:Oracle:fds','username','password') or print "ain't connecting"; my $test_query = "select category ,nvl(count,0) from ( select severity,count(1) count from fsc_rpt_vw where arrival_time >= trunc(sysdate-7) and assigned_to_group = 'CERES_FEDERATED' group by severity) a right outer join (select * from fsc_categories where type = 'SEV') b on b.category = a.severity order by category"; print "\n$test_query\n\n"; my $sth = $dbh->prepare($test_query); $sth->execute; #$cell = 63; my @results; while (@results=$sth->fetchrow_array) { print "category = $results[0]\n"; print "tkt_count = $results[1]\n"; print "results = @results\n\n"; }
CATEGORY NVL(COUNT,0) 1 0 2 11 3 15 4 7
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: While loop seems to miss data
by Fletch (Bishop) on Apr 10, 2006 at 15:35 UTC |