in reply to Re: DBI Out parameters
in thread DBI Out parameters

Hi, i have tried using bind_param for my second parameter. Still no luck. I have come to the conclusion that maybe one cant get at the variable on the left side of :=? For example, if i got my designer to write the function as

create procedure search(chime in varchar, id out number)

then i could use bind_param_inout to get at the id? For example:

$id = $plsql->bind_param_inout(":id",\$id,16);<br> print "$id";<p>
Am i correct in thinking that? Thanks

Replies are listed 'Best First'.
Re^3: DBI Out parameters
by almut (Canon) on Nov 19, 2008 at 14:37 UTC
    maybe one cant get at the variable on the left side of :=?

    It should work (I've done it many times myself...), so I think the problem lies elsewhere.

Re^3: DBI Out parameters
by mje (Curate) on Nov 19, 2008 at 14:52 UTC

    You certainly can get function return values back in perl. You can also get output arguments back in procedures. I do this all the time with DBD::Oracle.

    use DBI; use strict; my $h = DBI->connect('dbi:Oracle:xxx','xxx','xxx'); eval {$h->do(q{drop function fred});}; my $sql = <<'EOT'; create function fred(a integer) return integer as begin return (a + 1); end; EOT $h->do($sql); my $s = $h->prepare(q{begin ? := fred(?); end;}); $s->bind_param(2, 1); my $res; $s->bind_param_inout(1, \$res, 100); $s->execute; print "fred=$res\n";

    outputs fred=2