Another issue I missed - you've used fetchall_arrayref() (see DBI) and then attempted to access the results as a hash. Part of the issue is of course that I can't run your script to test it since I don't have access to your database so I can't debug. I can only guess that your code through the execute is functioning correctly. I do note that you are mixing hash and array access concepts in accessing the results. As per the documentation,

The fetchall_arrayref method can be used to fetch all the data to be returned from a prepared and executed statement handle. It returns a reference to an array that contains one reference per row.

So based on what I'm reading, you first need to modify your SQL to only select the column you are looking for (ROW_DATA presumably) and then access the results like an array reference:

foreach my $record (@$row1) { $report.= "$row1->[0]\n"; }

Alternatively, you could change the 0 in the above to reflect the appropriate column for what you are trying to do. Please read perlreftut, DBI and a review of Perl variable types might not be a bad idea. As well, please read the error messages and consider what they say.


In reply to Re^3: How to Fetch records from Oracle DB view by kennethk
in thread How to Fetch records from Oracle DB view by Rocko19

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.