Hey gang-
I'm sure I must be missing something obvious (it's been one of those weeks),
but I can't for the life of me figure out why this doesn't work. It just
hangs and never finishes. Any help would be much appreciated.
ltg
#!/usr/local/bin/perl
use DBI;
$ENV{ORACLE_HOME} = '/opt/oracle/product/8.1.6';
$ENV{ORACLE_SID} = 'dev1';
$dbh = DBI->connect("DBI:Oracle:tamarac_dev1","sys","password", {
PrintError => 1} )
|| die "Can't connect ", $dbh->errstr();
$sql = "SELECT vs.username, vs.serial#, vl.id1, vst.sql_text
FROM v\$session vs, v\$lock vl, v\$sqltext vst
WHERE vs.lockwait = vl.kaddr
AND vst.address = vs.sql_address
AND vst.hash_value = vs.sql_hash_value";
$sth = $dbh->prepare($sql)
|| die "Can't prepare statement ", $sth->errstr();
$sth->execute()
|| die "Can't execute statement ", $sth->errstr();
$sth->bind_columns(undef, \$username, \$serial, \$id1, \$sqltext);
while ($sth->fetch) {
print "username: [$username]\n serial: [$serial]\n id1: [$id1]\n sqltext:
[$sqltext]\n\n";
}
$dbh->disconnect;