I’m attempting to load some data into an HSQLDB database using Liquibase 1.9.5. I have a loadData command as follows:
In my CSV data file I'm attempting to set the ID value to the next value from an existing sequence:
id,name,description
next value for SEQ_ITEM_TYPE_ID,Test Name,A test description
However, this doesn't work as it generates the following SQL:
INSERT INTO LIST_ITEM_TYPE (id, description, name) VALUES ('next value for SEQ_ITEM_TYPE_ID', 'A test description', 'Test Name')
This is almost correct, except that the single quotes that Liquibase added around the "next value for SEQ_ITEM_TYPE_ID" part cause HSQLDB to give the following error:
java.sql.SQLException: data exception: invalid character value for cast
If I remove the sinqle quotes and run that SQL manually, it works as expected.
So, my question is, how do I use the Liquibase loadData command pulling data from a CSV file while populating one of the columns from a sequence?
I too face this issue. The above solution doesn’t seem to work for me.
I tried to use sequence.nextval in csv file but getting exception.
Then tried to use type=“COMPUTED” when defining columns in and use the function in CSV. But still it gives exception
INSERT INTO EMPLOYEE (EMPLOYEE_ID, NAME) VALUES (‘employee_seq.nextval’, ’ JOHN’); ORA-01722: invalid number ORA-06512: at line 4 Caused By: ORA-01722: invalid number