While creating table value set write your SQL statement directly in the place of table name but don’t miss to use distinct and alias name for SQL statement as shown below
Build Query with rowid to avoid the duplicate values
FROM TABLE_NAME T1
WHERE ROWID = (SELECT MAX (ROWID)
FROM TABLE_NAME T2
WHERE T1.ID = R2.ID)
Create view to get distinct values and use the same view while you are creating table value set.
Create view EMP_V as select distinct deptno from emp;
While creating value set ,check the check box “Allow Parent Values” as shown below screenshot.