
Please help me out from this situation
I have to create a function to retrieve the name of the manager for a given employee. (I was trying to join the emp table to itself to do this but not sure.) Also I need to write
a SQL select statement that uses the function to produce a list of employee numbers and names together with the name of their manager
Thanks
Filip’s function is not the best solution for a function which is called from a query of the EMP table. That table has the MGR attribute and that is what should be passed to the function.
These things perform badly enough without introducing another unnecessary read on the EMP table.
But as Filip days, this properly should be done in SQL, with a JOIN of the EMP table to itself.