# Loading data from CSV into HSQLDB with a sequence

**URL:** <https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072>\
**Category:** General Discussion\
**Created:** [January 19, 2011, 10:27pm UTC](https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072 "2011-01-19T22:27:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![moniker](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@moniker](https://forum.liquibase.org/u/moniker)\
**Post date:** [January 19, 2011, 10:27pm UTC](https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072/1 "2011-01-19T22:27:00Z")

</div>

I’m attempting to load some data into an HSQLDB database using Liquibase 1.9.5. I have a loadData command as follows:

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
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?

---

<div class="post-metadata">

**Author:** ![harryharrison](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@harryharrison](https://forum.liquibase.org/u/harryharrison)\
**Post date:** [January 19, 2011, 10:27pm UTC](https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072/2 "2011-01-19T22:27:00Z")

</div>

Hi,  
  
I’d like this too (with oracle). Did you find a solution?  
  
Would the following proposal work as a new Liquibase feature?  
  
a new column type of SEQUENCE, and you’d probably need an optional attribute for the sequence name.  
  
Best Regards,  
Harry

---

<div class="post-metadata">

**Author:** ![harryharrison](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@harryharrison](https://forum.liquibase.org/u/harryharrison)\
**Post date:** [January 19, 2011, 10:27pm UTC](https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072/3 "2011-01-19T22:27:00Z")

</div>

or more generally ( and less portably) a type of SQL, where the cell data is as moniker tried?  
  
or for type of SEQUENCE, the id column in the csv could contain the sequence name

---

<div class="post-metadata">

**Author:** ![harryharrison](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@harryharrison](https://forum.liquibase.org/u/harryharrison)\
**Post date:** [January 19, 2011, 10:27pm UTC](https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072/4 "2011-01-19T22:27:00Z")

</div>

found Nathan’s answer on stack overflow to&nbsp; similar question. trying a few things, meanwhile, wrestling with checksums ![](https://sea2.discourse-cdn.com/flex020/ze/images/tongue_out.gif)

---

<div class="post-metadata">

**Author:** ![harryharrison](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@harryharrison](https://forum.liquibase.org/u/harryharrison)\
**Post date:** [January 19, 2011, 10:27pm UTC](https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072/5 "2011-01-19T22:27:00Z")

</div>

All sorted out of the box:

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [January 19, 2011, 10:27pm UTC](https://forum.liquibase.org/t/loading-data-from-csv-into-hsqldb-with-a-sequence/1072/6 "2011-01-19T22:27:00Z")

</div>

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.

&nbsp;

Then tried&nbsp;to use type=“COMPUTED” when&nbsp;defining columns in and use the function in CSV. But still it gives exception

&nbsp;

INSERT INTO EMPLOYEE (EMPLOYEE\_ID, NAME) VALUES (‘employee\_seq.nextval’, ’ JOHN’);  
ORA-01722: invalid number  
ORA-06512: at line 4  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Caused By: ORA-01722: invalid number
