[h2] Re: Error on NaN literal in SQL statement

2023-01-26 Thread Silvio

Hello Evgenij,

Thanks for the swift response. That is just the information I was looking 
for. Thank you very much.

Kind regards,

Silvio

On Thursday, 26 January 2023 at 15:25:14 UTC+1 Evgenij Ryazanov wrote:

> Hello!
>
> NaN is not a literal, it's just an identifier.
>
> In this case you can pass it as a character string literal:
> INSERT INTO "TABLE"(ID, DOUBLE_COLUMN) VALUES (10, 'NaN');
>
> In more complex cases where data type cannot be determined automatically a 
> cast is needed:
> CAST('NaN' AS DOUBLE PRECISION)
>
> There are two other special values: CAST('Infinity' AS DOUBLE PRECISION) and 
> CAST('-Infinity' AS DOUBLE PRECISION).
>
> REAL and DECFLOAT data types also have these three special values in H2, 
> but all other numeric data types (TINYINT, SMALLINT, INTEGER, BIGINT, and 
> NUMERIC) don't support them.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/ffdac278-11ed-4b56-89bb-36036db470b5n%40googlegroups.com.


[h2] Re: Error on NaN literal in SQL statement

2023-01-26 Thread Evgenij Ryazanov
Hello!

NaN is not a literal, it's just an identifier.

In this case you can pass it as a character string literal:
INSERT INTO "TABLE"(ID, DOUBLE_COLUMN) VALUES (10, 'NaN');

In more complex cases where data type cannot be determined automatically a 
cast is needed:
CAST('NaN' AS DOUBLE PRECISION)

There are two other special values: CAST('Infinity' AS DOUBLE PRECISION) and 
CAST('-Infinity' AS DOUBLE PRECISION).

REAL and DECFLOAT data types also have these three special values in H2, 
but all other numeric data types (TINYINT, SMALLINT, INTEGER, BIGINT, and 
NUMERIC) don't support them.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/97b9ab12-90a9-4b15-90a3-586e55f8ff96n%40googlegroups.com.