in reply to Re: Using DBI for the first time...
in thread Using Oraperl for the first time... (was: Using DBI for the first time...)
The rewrite is quite simple:
Note that I don't do any error checking. This is because I set $dbh->{RaiseError} in the connect call, so the DBI will do all neccessary errorchecking for me!#!/usr/bin/perl -w use strict; use DBI; use Env; my $DB = "DBNAME"; my $UN = "USERNAME"; my $PW = "PASSWORD"; my ($dbh,$sth,$clli,$c); $dbh = DBI->connect("dbi:Oravel:$DB",$UN,$PW, {AutoCommit => 0, RaiseError => 1) or die("Oracle login FAILED, $DBI::errstr"); $sth = $dbh->prepare("select distinct(clli) from gvc_traffic30"); $sth->execute; $sth->bind_col(1, \$clli); while ($sth->fetchrow_arrayref ) { $c++; if ($clli =~ /\W/ ) { print "Found bad character in line $c."; } else { print "This clli appears to be OK."; } print " : $clli\n"; }
Check the DBI documentation to see what this does.
Happy DBI'ing
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Using DBI for the first time...
by snafu (Chaplain) on Aug 21, 2001 at 18:01 UTC |