I need to add a series of data from 0 to 1000 in a column of a table in LibreOffice Base and I would like to find a way with a SQL command instead to insert all 1000 one by one. Is it possible to do or not?
Asked
Active
Viewed 125 times
2
-
Which LibreOffice version? They changed the embedded database from HSQLDB to Firebird and the answer will depend on which one you use – Oct 16 '19 at 08:09
-
LibreOffice Base 5.2.7.2 on Debian 9.1 – Luca DEL PARTITA Oct 17 '19 at 02:15
1 Answers
0
The version of HSQLDB (1.8.0) traditionally supplied with LibreOffice and OpenOfficeOrg is now over 10 years old and does not support advanced features. You can use the "split database" solution in order to use a recent version (2.4.x or 2.5.x) of HSQLDB. This has been documented at length here:
https://forum.openoffice.org/en/forum/viewtopic.php?f=83&t=61183
With the recent versions of HSQLDB, you can insert values from the SEQUENCE_ARRAY function. In the following example, a table that has one column is populated with values (0, 1000):
CREATE TABLE T (ID INT);
INSERT INTO T (SELECT * FROM UNNEST( SEQUENCE_ARRAY(0, 1000, 1)) );
The SEQUENCE_ARRAY function is documented here:
http://hsqldb.org/doc/2.0/guide/builtinfunctions-chapt.html#bfc_array_functions

fredt
- 24,044
- 3
- 40
- 61