Search code examples
javaoracle-databasejdbchsqldbliquibase

Create table with longvarchar consistently in Hsqldb and Oracle


In my project, we use hsqldb for running unit test cases and oracle in production. Liquibase is used to run queries on environments. I have an issue with creating table with datatype LONGVARCHAR. I am already using this statement to use oracle syntax in hsqldb.

SET DATABASE SQL SYNTAX ORA TRUE

When I try to create table in hsqldb, this query seem to work.

CREATE TABLE A (DATA LONGVARCHAR);

And when I try to create table in oracle, the following works.

CREATE TABLE A (DATA LONG VARCHAR);

How can I write a homogeneous query which can work for both database servers.


Solution

  • Use a CLOB

    CREATE TABLE A (DATA CLOB);