Thanks for all the responses! learned something new
today. The DBI perldoc and URLs are also helpful.

thanks.

susan

--- Michael A Chase tech <[EMAIL PROTECTED]> wrote:

> On 02/24/2005 08:08 AM, susan lam said:
> 
> > I'm new to perl. I apologize if this is not the
> right
> > place to post newbie questions. 
> 
> This is the right forum for DBI and DBD questions.
> 
> > If mytable does not exist, I would like to trap
> the
> > Oracle error message and write the message to an
> > Oracle table. I know how to write to a table but I
> do
> > not know how to trap the message. 
> 
> http://search.cpan.org/~timb/DBI/DBI.pm#RaiseError
> 
> http://search.cpan.org/~timb/DBI/DBI.pm#Transactions
> 
> If RaiseError = 0, you can check each individual
> method for failure 
> similar to the way you checked connect().  That
> check actually has no 
> effect below because {RaiseError => 1} will cause
> connect() to die 
> instead of returning if it fails.
> 
> If RaiseError = 1, you can wrap the method calls in
> eval{} and then 
> check the contents of $@ and $DBI::errstr.
> 
> > $dbh =
> >
>
DBI->connect("dbi:Oracle:mydb",scott,tiger,{RaiseError
> > => 1, AutoCommit => 0}) || die "Database
> connection
> > failed: $DBI::errstr";
> > $sql = qq {select * from mytable};
> > $sth = $dbh->prepare($sql);
> > $sth->execute;
> > $dbh->disconnect;
> > 
> > Also, if mytable does exist, how can I obtain the
> row
> > count returned from the above query and assign it
> to a
> > variable?
> 
> http://search.cpan.org/~timb/DBI/DBI.pm#rows
> 
> The only reliable way to get a count of rows is to
> count them.
> 
> -- 
> Mac :})
> ** I usually forward private questions to the
> appropriate mail list. **
> Ask Smarter:
> http://www.catb.org/~esr/faqs/smart-questions.html
> Give a hobbit a fish and he eats fish for a day.
> Give a hobbit a ring and he eats fish for an age.
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to