0

When run below query results is empty. Is it possible use some eg. NVL for return some value eg. -1

Select ename from emp where empno = 1

1 Answer 1

2

If you are expecting one row, you can use aggregation:

Select coalesce(max(ename), '-1')
from emp
where empno = 1;

This always returns one row, even when there is no match.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.