Writing user defined function the same way as the oracle functions
Rajan SwSep 26 2012 — edited Sep 26 2012Hi Guys,
In one of the interviews , I have attended the guy asked me to write a user defined function which will take the column name and list all the values .
For example
Table Name:Employees
Column Name: Employee_Name
Employee_name
Scott
Ivgun
Jack
Shane
The query should be in this fromat
SELECT col_agg(Employee_name) emp_name from Employees;
The output shoulld be
Emp_names
scott,ivgun,jack,shane
Please let me know if this is possible
Any suggestions will be highly appreciated.
Thanks,
Ranjan