Skip to content
Advertisement

How to declare a cursor inside another cursor

How declare another cursor inside cursor c_employees?

Note: cursor c_employees return employees_id and this id pass to other cursor in the where clause.

For example

Advertisement

Answer

Cursors can take parameters hence

But generally, when you start seeing cursors with cursors etc etc…its also time to look at whether the queries can be replaced with a JOIN. For example, it might be the case that the code above could just be

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement