Re: PLSQL - handling errors when using an implicit cursor

Have a look at

http://www.oracle-base.com/articles/10g/DmlErrorLogging_10gR2.php

On Wed, Jun 29, 2011 at 4:20 PM, Schauss, Peter (ESS) <peter.schauss@xxxxxxx
> wrote:

> I have a stored procedure which is copying and, in some cases, transforming
> data from one table to another.  For some reasons related to the application
> requirements, I have to use code in the form:
>
> insert into target_table (c1,c2, c3,...)
>        (select s1,s2,s3,...)
>        from source_table
>        where ...);
>
> I am trying to work out a way to handle errors so that we can determine
> which row in the source table caused the insert to fail.  The only thing I
> have thought of so far would be to use an ORDER BY clause in the select
> statement.  Then the SQL%ROWCOUNT+1 would be the offending row in the source
> table.  I could then retrieve that row with a select statement.  Read
> consistency should insure that it would be the same row as long as I do not
> commit or roll back the transaction. Can anyone suggest a less cumbersome
> solution?
>
> Thanks,
> Peter Schauss
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>


-- 
Rumpi Gravenstein

Other related posts: