Hi,

I'm afraid you need to use
MERGE INTO VERSION_NUM (LOCK, VERSION, LOADED_FLAG) VALUES('X', 123,TRUE);

> I am using version: 1.3.173

Actually, according to the error code (90081-166) you are using version
1.3.166.

Regards,
Thomas


On Tue, Jul 29, 2014 at 8:25 AM, danielfb <[email protected]> wrote:

> Hi all,
>
> I have this table definition:
>
> CREATE TABLE IF NOT EXISTS VERSION_NUM (
>                         LOCK char(1) DEFAULT 'X'  not null PRIMARY KEY,
>                         VERSION BIGINT,
>                         LOADED_FLAG boolean,
>                         constraint CK_T1_Locked CHECK (LOCK='X'))
>
> I am trying to insert a record like:
>
> MERGE INTO VERSION_NUM (VERSION, LOADED_FLAG) VALUES(123,TRUE);
>
> But this is not possible as I am getting this exception:
>
> Column "LOCK" contains null values; SQL statement:
> MERGE INTO VERSION_NUM (VERSION, LOADED_FLAG) VALUES(123,TRUE) [90081-166]
> 90081/90081 (Help)
>
> The idea is to have a table with only one row, so the 'MERGE' changes or
> inserts (if it is the first record) only the single record.
>
> Am I doing something wrong? In my opinion the merge should work even there
> is no value in the table because of the 'default 'x' definition for the
> column lock.
>
> Any ideas?
>
> I am using version: 1.3.173
>
>
>
> --
> View this message in context:
> http://h2-database.66688.n3.nabble.com/Error-in-merge-into-for-empty-table-with-a-column-with-a-default-value-tp4029713.html
> Sent from the H2 Database mailing list archive at Nabble.com.
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to