johnirl has asked for the wisdom of the Perl Monks concerning the following question:
my $dbh = DBI->connect('DBI:DB2:dbname', 'username', 'password.') or die "Couldn't open database: $DBI::errstr; stopped"; #Prepare the SQL query for execution my $sth = $dbh->prepare(<<End_SQL) or die "Couldn't prepare statement: + $DBI::errstr; stopped"; SELECT values FROM table; End_SQL # Execute the query $sth->execute() or die "Couldn't execute statement: $DBI::errstr; stop +ped"; # Fetch each row and print it while ( my (@result) = $sth->fetchrow_array() ) { my $result_to_print = join(",",@result); print $result_to_print . "\n"; } # Disconnect from the database $dbh->disconnect();
j o h n i r l .
Sum day soon I'Il lern how 2 spelI (nad tYpe)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Substituting '--' for Nulls
by Abigail-II (Bishop) on Aug 13, 2002 at 10:09 UTC | |
by virtualsue (Vicar) on Aug 13, 2002 at 12:24 UTC | |
by Abigail-II (Bishop) on Aug 13, 2002 at 12:40 UTC | |
by Anonymous Monk on Aug 13, 2002 at 12:42 UTC | |
by johnirl (Monk) on Aug 13, 2002 at 10:26 UTC | |
|
Re: Substituting '--' for Nulls
by rattusillegitimus (Friar) on Aug 13, 2002 at 14:57 UTC | |
|
Re: Substituting '--' for Nulls
by johnirl (Monk) on Aug 13, 2002 at 12:53 UTC |