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.


In reply to Re: Trying to use DBD::Oracle by ptum
in thread Trying to use DBD::Oracle by hj4jc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.