BASE firebird - Error inserting multiple rows into a column

Hi there,

I run into a problem trying to insert multiple rows into a table column:

This works:

INSERT INTO “water_extract” (“ID”, “sample_id”)
VALUES (3, 1002)

This does not:

INSERT INTO “water_extract” (“ID”, “sample_id”)
VALUES (3, 1002), (4, 1003)

This is the error I get:

1: firebird_sdbc error:
*Dynamic SQL Error
*SQL error code = -104
*Token unknown - line 2, column 17
*,
caused by
‘isc_dsql_prepare’

Any help would be appreciated,

Thanks!

Hello,

Whenever you may have a problem with SQL for a database, it is best to refer to the documentation. Firebird documentation is found here → Firebird 2.5 Language Reference (English). This is the latest version.

Also note this Firebird page → How to insert multiple rows in a single statement?.

Using my own table this works without a problem.

So your statement should be:

INSERT INTO "water_extract" ("ID", "sample_id")
SELECT 3, 1002 FROM RDB$DATABASE UNION ALL
SELECT 4, 1003 FROM RDB$DATABASE;