Tim Bunce wrote:

> Try a $update->bind_param_inout(..., { ora_type => ORA_RSET }) so 
> oracle knows you're passing a cursor. Use trace to see more detail.

Okay, specifics? While I got the select to work okay, I have yet to see
a working example of UPDATE ... WHERE CURRENT OF in Oracle using DBI.

On Wed, Aug 15, 2001 at 06:14:28PM -0700, Rob McMillin wrote:
> Revisions:
> 
> Oracle 8.1.7.1.1 (8i release 3)
> RedHat 6.2
> Perl 5.6.0
> DBD::Oracle 1.07
> 
> I'm trying to bind a cursor so I can use the "FOR UPDATE OF" clause to

> do updates and deletions.  However, I can't even get the select 
> working correctly!  Here's my Perl code:
> 
> #!/usr/bin/perl
> 
> use DBD::Oracle qw(:ora_types);
> 
> $dbh = DBI->connect("dbi:Oracle:host=<host>;sid=SID",
>                     "<userid>","<mumble>",{AutoCommit => 0}) ||
>     die "can't connect to Oracle: ".$dbh->errstr."\n";
> 
> $select = $dbh->prepare("begin\n".
>                         "  open :cursor for\n".
>                         "    select b from a for update of b;\n".
>                         "end;");
> 
> $select->bind_param_inout(":cursor",\$cursor, 0, { ora_type => 
> ORA_RSET });
> 
> $select->execute;
> 
> $update = $dbh->prepare("begin\n".
>                         "  update a set b=? where current of ?;\n".
>                         "end");
> while(@f = $cursor->fetchrow_array)
> {
>     $update->execute($f[0]+1,$cursor);
> }
> print "done\n";
> 
> ========
> 
> Now, I *know* I have data in the table "A":
> 
> 
> SQL> select * from a;
> 
>          B
> ----------
>          1
>          2
>          3
>          4
> 
> ========
> 
> Yet it never returns any values.  Any ideas, guys?  This to me seems 
> like a minimal test case.

--
[EMAIL PROTECTED] | Dog is my co-pilot.

Reply via email to