Hello Monks, Greetings !!

I am facing problem while executing an outer join querry in Oracle 8i DB using Perl.

I am using perl DBI::DBD

#open connection to the database my $db = DBI->connect("dbi:Oracle:host=$host;sid=$sid;port=$port", $ui +d, $pwd) or die "Error while connecting to database!!!\nIncorrect Con +nection information\n"; my $SQL_query; $SQL_query = qq {SELECT A.DISPLAY_ORDER, A.NAME PARENT_NAME, B.NAM +E CHILD_NAME FROM CATEGORY A, CATEGORY B WHERE B.ID_PARENT_CATEGORY(+ +) = A.ID_CATEGORY AND A.DISPLAY_ORDER != -1 ORDER BY DISPLAY_ORDER}; debug($SQL_query); my $sth = $db->prepare( $SQL_query ) or die "Can't prepare SQL st +atement: $DBI::errstr\n"; ### Execute the statement in the database $sth->execute or die "Can't execute SQL statement: $DBI::errstr\n"; my ($pdisplay_order, $parent_name, $child_name); # Bind perl variables to columns: my $rv = $sth->bind_columns(\$pdisplay_order, \$parent_name, \$child_ +name); ### Retrieve the returned rows of data while ($sth->fetchrow_array()) { chomp($pdisplay_order); chomp($parent_name); chomp($child_name); print "$pdisplay_order, $parent_name, $child_name\n"; }
However, when I use the following, I can fetch the values from the tab +le / view #$SQL_query = qq {SELECT display_order, name, id_parent_category from + CATEGORY ORDER BY DISPLAY_ORDER }; #$SQL_query = qq {SELECT display_order, name, id_parent_category f +rom MY_VIEW }; I tried creating a oracle view for the SQL query which has the outer j +oin and used the following query but still I could not display the va +lues from the array. #$SQL_query = qq {SELECT * from VW_CATEGORIES};

Any immediate help is appreciated

CHEERS Ananda


In reply to Reading Database with Outer Joins by Ananda

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.