develooper Front page | perl.dbi.users | Postings from April 2010

Re: How to discard the error in SQL query

Thread Previous | Thread Next
From:
Parag Kalra
Date:
April 30, 2010 13:26
Subject:
Re: How to discard the error in SQL query
Message ID:
r2l736082cf1004301326u30c172au4876a9efe2b634c6@mail.gmail.com
I am executing simple insert SQL queries in a loop

I have a simple requirement - While insert quieries are being executed, if
any error occurs it should print that message and move to next insert sql
query. I am using DBD::Oracle on Unix

Cheers,
Parag



On Fri, Apr 30, 2010 at 1:10 PM, Ovid <publiustemp-dbic@yahoo.com> wrote:

> ----- Original Message ----
> > From: Parag Kalra <paragkalra@gmail.com>
>
>
> > I am executing list of SQL queries from a file. Currently if
>  > there is an error (like syntax issue) in any of the sql query it
> doesn't
> > processes the other remainig queries.
> >
> > I tried executing the queries in  'eval' but it doesn't seem to work. I
> am
> > using DBI and DBD::Oracle
>
>
> Without seeing the code and seeing the error, it's not possible to know
> exactly what is going wrong here.
>
> If you're trying to process several sql queries with a single $dbh->do,
> then it's quite natural than an eval won't allow subsequent queries to
> execute because they're all in the same transaction.
>
> It's also possible that you're trying to execute the sql statements
> separately, but it's failing on query which inserts data that subsequent
> queries are dependant on.  Again, it's not possible to say if this is what's
> happening without seeing some code and error messages.
>
>
> Cheers,
> Ovid
>  --
> Buy the book - http://www.oreilly.com/catalog/perlhks/
> Tech blog - http://blogs.perl.org/users/ovid/
> Twitter - http://twitter.com/OvidPerl
> Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
>
>
>


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About