I am getting input into data variable as a string of numbers . but emp_id is integer datatype so , when i ran this query it throws error
**i am unable to work "with" or declaring variables as part of solution . there are similar questions which doesnt satisfy my question.
data is not from a table it is given by some program
so, please dont mark it duplicate** i want some kind of cast/ inner query such that outer query can succesfully run
data='1,2,3'
select * from employees where emp_id in (data)
select * from employees where emp_id in ('1,2,3')
this throws error - invalid number
i think we should remove single quotes or cast into list of integers
like
select * from employees where emp_id in (1,2,3)
i think data has
data='1,2,3'
select * from employees where emp_id in (data)
select * from employees where emp_id in ('1,2,3')
expected output is
i want some kind of cast/ inner query such that outer query can succesfully run
such as
select * from employees where emp_id in (your query or cast or function)