# 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; } #### 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 ); #### create or replace procedure insert_profile_survey( p_primary_usage VARCHAR DEFAULT NULL, p_gender VARCHAR DEFAULT NULL, ...