in reply to Trying to use DBD::Oracle
So, I don't know anything about running Perl in a Windows environment, but I can point out one or two very obvious thing(s) you are doing wrong. First, you want 'use DBI;' rather than 'use DBD::Oracle;' unless there is some weirdness about using SQL::Statement (which I have never used) that I don't know about. Second, you want to retrieve your results into some kind of data structure, not just let them fall to the floor:
use strict; use DBI; # make the connection the way you have shown my @resultrow = (); my $resultref = $dbh->selectrow_arrayref("select ID from study where NAME='$unique_search_string_here'"); if (ref($resultref) eq 'ARRAY') { @resultrow = @{$resultref}; # do something with $resultrow[0] } else { # check for error in $DBI::errstr, etc. }
This will work only where you have a unique search string that returns only a single row of data ... if you can have multiple rows, use selectall_arrayref, which will give you a reference to an array of array references. Take a few moments and familiarize yourself with DBI.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Trying to use DBD::Oracle
by BigJoe (Curate) on Oct 24, 2006 at 18:03 UTC | |
by ptum (Priest) on Oct 24, 2006 at 18:47 UTC | |
Re^2: Trying to use DBD::Oracle
by hj4jc (Beadle) on Oct 24, 2006 at 21:16 UTC |