I wrote the following in perl but it is not running. Anything wrong with it?
Stored Procedure created in Oracle
CREATE OR REPLACE procedure select_pm (n_QC_DEPL_S1 in NUMBER) is n_PM_DEPL_S1 NUMBER(3); begin DBMS_OUTPUT.PUT_LINE (n_QC_DEPL_S1); select PM_DEPL_S1 into n_PM_DEPL_S1 from EIP_SR_SECT_PERF where QC_DEPL_S1 = n_QC_DEPL_S1; DBMS_OUTPUT.PUT_LINE (n_QC_DEPL_S1); end select_pm; /

Perl program to get the results
#!/usr/bin/perl use DBI; use strict; require 'insert_db_dev.pl'; require 'database_dev.pl'; require 'general_functions.pl'; open(LOGFILE, '> ..\\logs\\geraltan_stored_proc.txt') or die "Can't cr +eate logfile!\n"; get_results(); sub get_results() { printlog("Connecting to database."); #my $dbh=connect_db(get_user_passwd()); my $dbh = DBI->connect('dbi:Oracle:host=ABC;sid=ABC123;port=1521', + 'abc','abc'); printlog("Connected."); my $rv; eval { my $func = $dbh->prepare(q{ BEGIN :cursor := select_pm( parame +ter1_in => :parameter1); END; }); $func->bind_param(":parameter1", '2'); $func->bind_param_inout(":cursor ", \$rv, 0, { ora_type => ORA +_RSET}); $func->execute; $func->finish; $dbh->commit; } if( $@ ) { warn "Execution of stored procedure failed: $DBI::errstr\n"; $dbh->rollback; } printlog("Execution of stored procedure returned $rv\n"); while(my $hashRef = $rv->fetchrow_hashref) { foreach(keys %$hashRef) { printlog("$_ is $hashRef->{$_}\n"); } } $rv->finish; printlog("Disconnecting from database..."); $dbh->disconnect; printlog("Disconnected."); } sub printlog($) { my $msg=shift; print $msg,"\n"; print LOGFILE $msg,"\n"; } close LOGFILE;

In reply to Re^4: Getting stored procedure results from Oracle using a Perl by geraltan
in thread Getting stored procedure results from Oracle using Perl by geraltan

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.