Hello again pryt,

I hope you still follow our thread. I found some time and decide to look into it a bit more. Regarding the part you said # thanos1983's links suggested a two-step process: can be done in one step also to minimize the resources. You can use the do method. In your case it can be used without the prepare execute step.

From the documentation:

This method is typically most useful for non-SELECT statements that ei +ther cannot be prepared in advance (due to a limitation of the driver +) or do not need to be executed repeatedly. It should not be used for + SELECT statements because it does not return a statement handle (so +you can't fetch any data).

Having said that, here is a sample that replicates your test, based on your final post:

#!/usr/bin/perl use strict; use warnings; use Test::More; use DBI qw/:sql_types/; my $dsn = 'DBI:mysql:database=DB'; my $dbh = DBI->connect($dsn, 'user', 'psw', {RaiseError => 1}); my $sth = $dbh->prepare('SELECT "Hello World"'); $sth->execute(); printf "SELECT rows = %d\n", scalar $sth->rows; printf "\t(@$_)\n" for $sth->fetchrow_arrayref; my $rows = $dbh->do('CALL DebugMe(@dmvar)') or die $dbh->errstr; my ($v) = $dbh->selectrow_array('SELECT @dmvar'); is( $dbh->errstr , undef , 'SELECT(@dmvar) without error' ); is( $v , 'HELLO' , 'DebugMe(@dmvar); SELECT @dmvar' ); done_testing(); $sth->finish; __END__ $ perl mysql.pl SELECT rows = 1 (Hello World) ok 1 - SELECT(@dmvar) without error ok 2 - DebugMe(@dmvar); SELECT @dmvar 1..2

The idea came from the MySQL forums HOW TO RETRIEVE AN "OUT" PARAMETER OF MYSQL STORED PROCEDURE IN PERL. I remembered the user mentioned that is working, worth it to give it a try.

Relevant question Multiple data sets in MySQL stored procedures,in case of future reference(s).

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re: How to access MySQL stored procedures OUT parameter(s) by thanos1983
in thread How to access MySQL stored procedures OUT parameter(s) by pryrt

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, 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, 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.