I haplessly used the following SQL to create a DECIMAL column (a
common mistake, at least for me):

CREATE TABLE IF NOT EXISTS INSERT_TEST ( DECVALUE DECIMAL(6,12) );
INSERT INTO INSERT_TEST ( DECVALUE ) VALUES ( 0.08 );

Note "DECIMAL(6,12)" should correctly be written as "DECIMAL(18,12)"
when you want 6 digits left and 12 right.

H2 allows me to create the table, but fails bizarrely on the INSERT
statement.

I only discovered my snafu when I ported this to a MySQL instance I
have handy. MySQL faithfully reports an error on CREATE TABLE:

Error Code: 1427 For float(M,D), double(M,D) or decimal(M,D), M must
be >= D (column 'DECVALUE').

I'm guessing that a quick validation step in the right place could
stop us DBA-wanna-be's from shooting ourselves in the foot.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to