• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to user FORALL with Cursors

 
Skanda Siva
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement to retrieve ID from table and below is my code. This is working perfectly. However, seems like FORALL will be a best option to use than FOR in the Procedure.



Please advise how to use FORALL in my procedure code.
 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FORALL... is used with BULK COLLECT in Oracle PL/SQL to fetch and process lots of records at the same time, as described in Steven Feuerstein's article here.

But I'm not sure why you would use it in your example, as it looks like you're only fetching a few (or just one?) records anyway and not doing any bulk DML with them. And if you are only fetching one record i.e. the Department Name is unique, then you don't need a FOR loop at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic