I've never used DBI before. So I am doing something wrong here but I can't find it. Using sqlplus I get a return of about 200 rows. Using this script I get a return of 1?? The only thing I can think is that I am processing the query output incorrectly because the script seems to be taking the same amount of time running the query as sqlplus does.

-- snip --

$dbh = &ora_login($DB,$UN,$PW) or die("Oracle login FAILED."); $sql = "select distinct(clli) from gvc_traffic30"; $cursor = &ora_open($dbh,$sql) or die("Failed query (bad query?). $!\n +"); @MYARRAY= &ora_fetch($cursor) or die("Failed to get return from query. + $!\n"); foreach my $clli ( @MYARRAY ) { chomp($clli); $c++; if ( /\W/ ) { print "Found bad character in line $c."; } else { print "This clli appears to be OK."; } print " : $clli\n"; }

-- !snip --

The script is supposed to grab a list of items from the database that have either been stored properly or have been stored with improper characters in them. I will eventually get to fixing that but for now I am using my problem as a way or learning DBI. I am only concerned with seeing the data in the table for now (plus of course sorting each row out with non-alphanumerics in them).

I have tried for loops, foreach loops (above), and while loops (of course didn't work)...none of which seem to work so I can only assume that I am not getting the proper data into the proper data type somehow... ???

My current output is:

$ perl traffic.pl Use of uninitialized value in pattern match (m//) at traffic.pl line 3 +6. Use of uninitialized value in concatenation (.) at traffic.pl line 41. This clli appears to be OK. : $

Suggestions would be very much appreciated.

----------
- Jim

Edit: chipmunk 2001-08-20


In reply to Using Oraperl for the first time... (was: Using DBI for the first time...) by snafu

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.