Here is the snippet that i used to execute a query.
my $_connectOracle = sub { my $oracle_server = $_[0]; my $sid = $_[1]; my $user_id = $_[2]; my $password = $_[3]; my $db_type = "Oracle"; my $dbh; eval { $dbh = DBI->connect ("dbi:$db_type:host=$oracle_server;sid=$si +d", $user_id, $password, { PrintError => 0, RaiseError => 1 } ); }; if ($@) # check if the connection has made { $error_no = $DBI::err; $error_msg = $DBI::errstr; } return $dbh; }; sub executeQuery () { my $query_type = $_[1]; my $query_desc = $_[2]; my $oracle_server = $_[3]; my $sid = $_[4]; my $user_id = $_[5]; my $password = $_[6]; my $dbh; my $sth; # Statement handle my $output_values; my @output_values; # Get the database handle with the given input parameter. $error_no = ""; $dbh = &$_connectOracle($oracle_server, $sid, $user_id, $password) +; if ( ! $error_no ) { eval { if ($query_type eq "S") { $sth = $dbh->prepare($query_desc); $sth->execute(); while ($output_values = $sth->fetchrow_hashref) { push (@output_values, $output_values); } } else { $dbh->do("$query_desc"); } $dbh->disconnect(); }; if ($@) { $error_no = $DBI::err; $error_msg = $DBI::errstr; } return @output_values; } else { print "\nCannot connect to database\n"; print "because $error_no\n"; } }
what am doing here is when i call the execute sub-routine i build a string that will have the file contents (to create a proc. which is 1100 lines ). When i call this function am getting the oracle error 24344 which doesnot convey anything other than "the procedure created with compilation errors". But when i run the same procedure in the sql plus using @ am able to create the proc. without any error that ensures that the procedure is correct syntactially. Hope am clear.

Edit by castaway - added code tags


In reply to Re: Re: Buffer Problem in dbi module ? by subbu
in thread Buffer Problem in dbi module ? by subbu

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.