0

How to return "NaN" using SQRT function in Oracle SQL? Here is my unsuccessful attempt:

SELECT SQRT(4) AS "SQRT of 4",
 SQRT(0) AS "SQRT of 0",
 SQRT(-1) AS "SQRT of -1"
FROM DUAL;

As I understand, a successful query might use the TO_BINARY_DOUBLE function but additional approaches are welcome.

asked Feb 19, 2016 at 18:47

1 Answer 1

1

Cast the number, as you said:

SELECT SQRT(4) AS "SQRT of 4",
 SQRT(0) AS "SQRT of 0",
 SQRT(TO_BINARY_DOUBLE(-1)) AS "SQRT of -1"
FROM DUAL;
alexanderjsingleton
2712 gold badges7 silver badges19 bronze badges
answered Feb 19, 2016 at 19:43
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.