Pl/Sql Block Failure

Database
N/A

Pl/Sql Block Failure

Hi

I have pl/sql block which will update the target table. what i need here, if the block could not update the table block should get fail. I mean when the where clause is fail to update.

Block would be:

Begin

Update <Table Name> set Column1='Software' where Column2 = 1 and Column1='Profession';

End

Above block should get fail if there is no row with 1,Profession in the table.

Please advise on this

3 REPLIES
N/A

Re: Pl/Sql Block Failure

Could someone send me the code for above one

Re: Pl/Sql Block Failure

insert some data and try for update

Re: Pl/Sql Block Failure

ACTIVITY_COUNT is a feature TD provides, which can be leveraged for requreiemnts like this. It has the number of rows that was changed by the immeditate DML statement.

Update <Table Name> set Column1='Software' where Column2 = 1 and Column1='Profession';

SET row_update = ACTIVITY_COUNT;

If row_update = 0 THEN

<exit with failure>

END IF;