Задача Задача №3621818
А
А
Your query looks like Oracle SQL, but the CONCAT usage is off (and you’re missing a closing parenthesis). To return a single Y/N depending on whether a DBA row exists, you can simply write:
SELECT CASE WHEN EXISTS (SELECT 1 FROM session_roles WHERE role = 'DBA') THEN 'Y' ELSE 'N' END AS is_dba FROM dual;
Notes:
- You don’t need CONCAT here since you’re only returning a single value.
- If you really want to use CONCAT for some reason, you could do: SELECT CONCAT(CASE WHEN EXISTS (SELECT 1 FROM session_roles WHERE role = 'DBA') THEN 'Y' ELSE 'N' END, '') FROM dual; but the first form is clearer.