Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Skip rows in PL/SQL

3501915Sep 22 2017 — edited Sep 26 2017

Hi All,

I have table as follows, Table Name : emp_data

S.no Number,

Datas  varchar2(20)

Here the input

[/CODE]

S.no    Datas

1          25

2          DC9

3          9009

4          8NHD

.....

...

[/CODE]

i would like to write a uupdate statement on EMP_DATA table ,as

1. have to update the table.

2. if I found anything wrong for any record, it should skip that record and go for the next record and it has to update.

same should follow for all the records.

Can you please advise how to do this and how can we handle this.

I have written exception as follows

[/code]

savepoint ABCD

UPDATE  .......

IF SQL%ROWCOUNT != 1 THEN

  ROLLBACK TO SAVEPOINT ABCD;

  RAISE_APPLICATION_ERROR( -20001, 'More than one row found' );

END IF;  

[/code]

but as observed it will rollback the entire data if it finds any error in somewhere around in the middle of the records. but as per my requirement it should skip that wrong record

and update the further successful record. Please please help me out. 

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2017
Added on Sep 22 2017
37 comments
3,027 views