I have tables with columns as below:
Employee:
Id number(10),
Name varchar2(10)
Department:
Id number(10),
Name varchar2(10),
Emp_ids varchar2(10)
The values present in the tables respectively are:
Employee:
1,abc,111
2,def,222
3,xyz,333
Department:
111,development,'1,2'
222,testing,'2,3'
My problem is that I need to select Employee Names using the emp_ids
column from the Department table.
Example:
SELECT names FROM employee
WHERE id in (SELECT emp_ids FROM department WHERE name = 'development');
Since emp_ids
is varchar2 datatype I am unable to execute the above command.
NOTE: As I am using Activerecord Base Connection
to connect my Oracle DB from Ruby, I am including ruby in the tags too.