Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FORALL problem 1

Status
Not open for further replies.

dbomrrsm

Programmer
Feb 20, 2004
1,709
GB
I have a cursor that I fetch using bulk collect into an array.

I then use FORALL x IN a_array.FIRST..a_array.LAST and do an update of tablea with a where condition of: field_a = a_array(x); - this works fine

I then need to delete from a different table so do delete from tableb with a where condition of: where field_b = a_array(x);

because there are now two dml statements the second one errors with PLS-00201: identifier 'X' must be declared and this highlights the x in brackets in the second dml statement.

Is is possible to carry out multiple dml statements within a forall ?

TIA

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Dagon

Had tried that and it worked but thanks for taking the time to reply.

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Although it looks like a loop, FORALL isn't. It only relates to the statement which follows.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top