Running the following code:
String sqlStatement = "ALTER TABLE parent ADD FOREIGN KEY (c_id_col) REFERENCES child(id)";
try {
statement.execute(sqlStatement);
} catch (SQLException e) {
e.printStackTrace();
}
I got the exception
java.sql.SQLException: Syntax error: Stopped parse at FOREIGN KEY(id197)
|
ALTER TABLE parent ADD CONSTRAINT fk_author FOREIGN KEY (c_id_col) REFERENCES child (id)
|