How to use IS NULL in H2 database

476 views
Skip to first unread message

annie....@verteil.com

unread,
Sep 26, 2017, 1:56:15 AM9/26/17
to H2 Database

I have table ABC in H2 defined as CREATE TABLE ABC (A int,B varchar(30) DEFAULT NULL,C varchar(100) DEFAULT NULL);


I would like to run a query: Select * from ABC where C IS NULL;


Expected Result: All the values where C is null.

Obtained Result: No values at all...

Only the table structure. It works when I give where C='null'.


How can I use the IS NULL in H2. I tried by setting url as jdbc:h2:mem:configurations;DB_CLOSE_DELAY=-1;MODE=PostgreSQL.

It didn't work as expected.The query works fine with Postgres I am also using Postgres Db .

annie....@verteil.com

unread,
Sep 26, 2017, 2:20:23 AM9/26/17
to H2 Database

Christian MICHON

unread,
Sep 26, 2017, 12:44:51 PM9/26/17
to H2 Database
C='null' or C=null?

The single quotes might have strong effect here...

Kerry Sainsbury

unread,
Sep 26, 2017, 6:07:22 PM9/26/17
to h2-da...@googlegroups.com
You have inserted the string literal 'null', not the SQL value null.

On 27 September 2017 at 05:44, Christian MICHON <christia...@gmail.com> wrote:
C='null' or C=null?

The single quotes might have strong effect here...

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages