Exception while executing the alter to add column using namedjdbctemplate

563 views Asked by At

I have a alter query

ALTER TABLE Table_name  ADD(coumn1  DOUBLE,coumn2  DOUBLE);

I am using

this.namedParameterJdbcTemplate.execute(alterTableSQL, namedValues, new PreparedStatementCallback<Boolean>() {
    @Override
    public Boolean doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
        return ps.execute();
    }
});

While executing the statement, it is throwing me the following exception.

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [ALTER TABLE <sample>  ADD (
 coumn1  DOUBLE,
 coumn2  DOUBLE
);]; nested exception is org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "ALTER TABLE TEMPLATE_1  ADD ([*]
 coumn1  DOUBLE,
 coumn2  DOUBLE
); "; expected "identifier"; SQL statement:
ALTER TABLE template_1  ADD (
 coumn1  DOUBLE,
 coumn2  DOUBLE
); [42001-160]

How should I proceed on this?

0

There are 0 answers