With placeholders (the '?' in your sql statement), the
statement should only be prepared ONCE. you can then
execute it as many times as you want with different
tablespace arguments.

Even so, your error does not sound good, and I don't know
if the above suggestion will fix the problem. You should
also consider making your program work using 'use strict;'
and 'use warnings;' (or '-w').

-----Original Message-----
From: Laurie Gennari [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 12:15 PM
To: Dbi-Users (E-mail)
Subject: using statement handle in a loop


I'm looping on a list of tablespaces like so:

  foreach $tsName (@tablespaces) {

    $getDFsql = "select file_name
                 from dba_data_files
                 where tablespace_name = ?";
    $getDFhandle = $dbh->prepare($getDFsql);
    $getDFhandle->execute($tsName)
      || die "Can't get datafiles from dba_data_files"
         . $getDFhandle->errstr;
    $getDFhandle->bind_columns(undef, \$dfName);

    while ($getDFhandle->fetch) {
      push (@tsDatafiles, $dfName);
      $dfStatus{$dfName} = 0;
    }

more...

}

When it comes through on the second tablespace, it conks out with:

DBD::Oracle::db prepare failed: ORA-03113: end-of-file on communication
channel (DBD ERROR: OCIStmtExecute/Describe) at ./hot_bu_ltg.pl line 157.
Segmentation Fault

Is it upset about preparing the statement again with a new tablespace name?

ltg

Reply via email to