Sure, we use a similar wrapper to call our plsql.
# This is for calling stored procedures by just passing in a dbh, the +procedure name and a param hash sub call_plsql { my ( $self, $dbh, $name, $params ) = @_; my @vars; foreach $key ( keys %$params ) { push( @vars, "$key => :$key" ); } my $call = "BEGIN $name( " . join( ', ', @vars ) . ' ); END;'; warn "$call\n" if ( grep(/-v/, @ARGV) ); my $sth = $dbh->prepare( $call ); foreach $key ( keys %$params ) { if ( ref($params->{$key}) eq 'ARRAY' ) { $sth->bind_param_inout( ":$key", @{ $params->{$key} +} ); } else { $sth->bind_param( ":$key", $params->{$key} ); } } $sth->execute(); return; }
This is then called like (from an arbitrary example):
my $params = { p_PromoID => $promo_id, p_NumCodes => $cnt, o_NewCodes => [ \$sth, 0, { ora_type +=> 116 } ], o_Status => [ \$error, 250 ], }; call_plsql( $dbh, 'wp.create_unique_codes', $params );
Note that, in order to use plsql like this, you have to put default values on your variables:
create or replace procedure insert_profile_survey( p_primary_usage VARCHAR DEFAULT NULL, p_gender VARCHAR DEFAULT NULL, ...

-- Kirby, WhitePages.com


In reply to Re: Generic PLSQL Launcher by kirbyk
in thread Generic PLSQL Launcher by SPIDEY

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.