Gossamer Forum
Home : General : Perl Programming :

eval, DBI, DBD-Oracle

Quote Reply
eval, DBI, DBD-Oracle
hi,

i'm trying to use eval to rebuild some indexes on my Oracle db. everything works fine, but it dies if it comes to an index that doesn't exist.. (ie, it never gets past that point). i know i can query for existing indexes, but i wanted to take them from an existing array, and i'm wondering about catching other errors.
also, i don't really want to fork sqlplus or something.
Code:
eval {
foreach my $index (@indexes) {
$dbh->do("alter index $index rebuild");
}
};
this always dies if index doesn't exist.....so i don't have a chance to check $@

does anyone know how to do this?
Quote Reply
Re: [adrockjames] eval, DBI, DBD-Oracle In reply to
Above the foreach try adding:

local $SIG{__DIE__};

...I'm not sure it will work though but it's worth a try.
Quote Reply
Re: [Paul] eval, DBI, DBD-Oracle In reply to
thanks paul.. tried with no luck, but then used:

$dbh->{RaiseError} = 0;

so, now it doesn't die, but i still get $dbh-errstr to log problems.

thx again.
Quote Reply
Re: [adrockjames] eval, DBI, DBD-Oracle In reply to
Try adding this also:

$dbh->{PrintError} = 0;