hsqldb - HSQL: Creating index if not existing -


i'm initializing hsql database 2.2.9 via spring using

<jdbc:initialize-database enabled="true">     <jdbc:script execution="init" location="classpath:./create-tables.sql" /> </jdbc:initialize-database> 

in create-tables.sql use

create table if not exists mytable(...); 

the table has index. i'm looking better way dropping , creating index.

i tried:

create index if not exists myindex ...; 
  • does not work

i can create function indexexisting() checking system tables , returning count(*) > 0 if index found, if write

if indexexisting() = 0 ... 

directly .sql file, says

java.sql.sqlsyntaxerrorexception: unexcepted token: if 

also stored procedure not seem help, may not contain drop statements, far read.

so solution other dropping / creating index appreciated.

thank you

the latest version of hsqldb supports both:

create index if not exists myindex ... drop index if exists myindex 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -