Many a times, we come across situations where there is a need to return an array of objects from Oracle DB instead of rows of data.
Traditionally, in good old days whenever there was a need of array of objects (e.g.: Names of Employees from a particular department), we use to use a simple query to retrieve all DB rows with a particular department criteria (select Empname from Employee where Dept = ‘admin’). While the task of traversing all DB result rows and formation of array was done by backend code. Now, imagine repeating the procedure for hundreds of department, it will definitely burden the backend logic.