How do I check if a particular element exists in a table - how can I return true or false?
I have a table that has
Oracle RDBMS does not have boolean data type, you can only use boolean variables in PL/SQL.
If you simply want to return strings 'TRUE' and 'FALSE' you can do this..
SELECT 'TRUE' FROM DUAL WHERE EXISTS (SELECT 'x' FROM table WHERE user_id = 'id')
UNION
SELECT 'FALSE' FROM DUAL WHERE NOT EXISTS (SELECT 'x' FROM table WHERE user_id = 'id')
I like @DCookie's query though.