Re: Cursors: Can this DBI::Oracle code be converted to DBI::OCDB?



On Apr 11, 6:08 pm, "telespho...@xxxxxxxxx" <telespho...@xxxxxxxxx>
wrote:
The following code sample works just fine as it is. However, I need to
convert it so that it uses DBI::OCDB. Is this possible?

use strict;
use DBI;
use DBD::Oracle qw(:ora_types);

my $dbh = DBI->connect( 'dbi:Oracle:dsn', 'user', 'password' );

my $sth1 = $dbh->prepare(q{
BEGIN OPEN ? FOR
SELECT * FROM user_tables WHERE table_name like ?;
END;

});

my $sth2;
$sth1->bind_param( 2, $ARGV[0] );
$sth1->bind_param_inout( 1, \$sth2, 0, { ora_type => ORA_RSET } );
$sth1->execute;

while ( my @row = $sth2->fetchrow_array ) {
print "$row[0]\n";

}

$dbh->disconnect;

Google and the docs aren't helping here. I know that there is some
allowance for cursors in the ODBC because of the odbc_cursortype =>
DBI::SQL_CURSOR_DYNAMIC option. So there should be a way to do this.

So if some one can give me the correct syntax for binding an ODBC
cursor on ANY PLATFORM (Oracle, SQL/Server, etc.) even that would be a
huge help.

$sth1->bind_param_inout( 1, \$sth2, 0, { ora_type => ORA_RSET } );

Obviously, ora_type is wrong for ODBC but is there is an equivalent?

It looks like i might have to dig into the c source code if I can't
get an answer soon.

.



Relevant Pages

  • Re: SQL Server connectivity
    ... I feel like it must be something with the location of the cursors. ... table connection is probably using CLIENT side cursors. ... required by ODBC framework). ... > The problem is that the SQL server was moved to another office and a VPN ...
    (microsoft.public.data.ado)
  • Re: SQL Server connectivity
    ... It has been always my practice to set the recordset cursor to client side. ... > I feel like it must be something with the location of the cursors. ... > table connection is probably using CLIENT side cursors. ... > required by ODBC framework). ...
    (microsoft.public.data.ado)
  • Re: Fujitsu cobol and SQLServer
    ... I think from googling that I need to tell the odbc driver to use server ... Server side cursors with SQL Server are not a good idea and are best ... EXEC SQL ... Fujitsu assumes last connection until/unless you use SET CONNECTION. ...
    (comp.lang.cobol)
  • Cursor Question.
    ... can use w/ ODBC? ... If it can only use static cursors that only scroll forward what is the ...
    (microsoft.public.data.odbc)