Hi Chris,
Try this:
#!/usr/bin/perl
# Purpose: Perl script for testing Oracle Database
Connection
# First setenvironmental variable
BEGIN {
# Comment ORACLE_HOME variable if running on
window
$ENV{ORACLE_HOME} = '/usr/orasys/8.1.7';
$ENV{TWO_TASK} = 'mydbname';
}
use strict;
use DBI;
my $dbh =
DBI->connect('dbi:Oracle:','dbuser/[EMAIL PROTECTED]','')
or die "Connection Failure\n\a";
print "First Connection made Successfully\n";
$sql = qq{SELECT DISTINCT column1 FROM table WHERE
column2= -1};
my $sth = $dbh->prepare($sql) or die "Could not
prepare $sql\n";
$sth->execute() or die "Could not execute $sql\n";
while (my @temp = $sth->fetchrow_array()){
print @temp,"\n";
# or whatever you want to do with record
}
$sth->finish();
$dbh->disconnect or warn "Disconnection failure\n";
-----------------------------------------------
Hope this will help.
Regards,
Ashish
--- "McMahon, Chris" <[EMAIL PROTECTED]> wrote:
>
> Hello...
> My first DBI script was simply an inventory of
> columns in
> tables.
> Now I'm struggling with my second DBI script, and
> finding the
> CPAN docs tough going.
> Can anyone suggest DBI syntax to capture the result
> of
>
> SELECT DISTINCT column1 FROM table WHERE column2= -1
>
> into an array? Just a hint would help...
> -Chris
>
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> <http://learn.perl.org/>
> <http://learn.perl.org/first-response>
>
>
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>