Я получаю ошибку с SQL, но когда я запускаю ту же INSERT в SQL Developer, она работает.
Вот код:
// insert
String sql = "INSERT INTO matches (id, status, home_team_id, away_team_id, home_goals, away_goals) VALUES (?, ?, ?, ?, ?, ?)";
System.out.println( match.getId() ); // 233028
System.out.println( match.getStatus() ); // FINISHED
System.out.println( match.getHomeTeam().getId() ); // 66
System.out.println( match.getAwayTeam().getId() ); // 338
System.out.println( match.getHomeGoals() ); // 2
System.out.println( match.getAwayGoals() ); // 1
jdbcTemplate.update(
sql,
match.getId(),
match.getStatus(),
match.getHomeTeam().getId(),
match.getAwayTeam().getId(),
match.getHomeGoals(),
match.getAwayGoals()
);
Вот ошибка вfull:
Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO matches (id, status, home_team_id, away_team_id, home_goals, away_goals) VALUES (?, ?, ?, ?, ?, ?)]; nested exception is java.sql.SQLSyntaxErrorException: ORA-04044: procedure, function, package, or type is not allowed here
Вот вывод из SQL> DESCRIBE matches
:
Name Null? Type
------------ -------- ------------
ID NOT NULL NUMBER(6)
STATUS VARCHAR2(16)
HOME_TEAM_ID NUMBER(6)
AWAY_TEAM_ID NUMBER(6)
HOME_GOALS NUMBER(2)
AWAY_GOALS NUMBER(2)
Что-то я делаю не так?