menzies26 has asked for the wisdom of the Perl Monks concerning the following question:

I have a very simple Oracle PL/SQL procedure that contains some dbms_output statements.

#enable output $dbh->func( 1000000, 'dbms_output_enable' ); eval { my $func = $dbh->prepare( q {BEGIN SMTEST;END;}); $func->execute; $dbh->commit; $dbh->finish; }; #retrieve output my @text = $dbh->func( 'dbms_output_get' ); foreach (@text) { print "$_\n"; } $dbh->disconnect;

Output is

$ perl testsm.pl

SMTEST 1

SMTEST 2

SMTEST 3

$

If the procedure has a parameter passed then the dbms_output no longer appears

enable output $dbh->func( 1000000, 'dbms_output_enable' ); my $rv; eval { my $func = $dbh->prepare( q {BEGIN SMTEST($rv);END;}); $func->bind_param(":parameter1", \$rv, '0'); $func->execute; $dbh->commit; $dbh->finish; }; #retrieve output my @text = $dbh->func( 'dbms_output_get' ); foreach (@text) { print "$_\n"; } $dbh->disconnect;

Output is

rbmvm@tlnt smenzies$ perl testsm.pl

rbmvm@tlnt smenzies$

Any ideas or soltions most welcome

Replies are listed 'Best First'.
Re: dbms_output not working when calling pl/sql procedure with a parameter
by Fletch (Bishop) on Jul 24, 2019 at 16:25 UTC

    Might be maybe interesting (or possibly even helpful) to turn on DBI tracing to at least level two. You can call it either as a class method (DBI->trace( 2 )) or on a specific handle ($dbh->trace( 2 )).

    See the DBI docs for more details (look for the section "TRACING").

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: dbms_output not working when calling pl/sql procedure with a parameter
by soonix (Chancellor) on Jul 25, 2019 at 06:27 UTC
    my $func = $dbh->prepare( q {BEGIN SMTEST($rv);END;});
    Shouldn't the placeholder be a '?' instead of '$rv'?
Re: dbms_output not working when calling pl/sql procedure with a parameter
by holli (Abbot) on Jul 24, 2019 at 15:34 UTC
    Nevermind. The heat made me see things that aren't there.


    holli

    You can lead your users to water, but alas, you cannot drown them.