これは私のコードです:
triggerBuilder.append("DROP TRIGGER IF EXISTS `insert_associated_inquiry`; ");
triggerBuilder.append(" DELIMITER %% ");
triggerBuilder.append(" CREATE TRIGGER insert_associated_inquiry BEFORE UPDATE ON inquiry ");
triggerBuilder.append(" FOR EACH ROW Begin ");
triggerBuilder.append(" insert into associated_inquiries(inquiry_id , subject , content , inquiry_date , preferred_date ) " );
triggerBuilder.append("values");
triggerBuilder.append(" ( " );
triggerBuilder.append(" OLD.id , ");
triggerBuilder.append(" OLD.subject , " );
triggerBuilder.append(" OLD.content , " );
triggerBuilder.append(" OLD.created_on , " );
triggerBuilder.append(" OLD.preffered_date " );
triggerBuilder.append(" ) ; ");
triggerBuilder.append(" END %% ");
triggerBuilder.append(" DELIMITER ; ");
con.createStatement().execute(triggerBuilder.toString());
そして、これはスローされたエラーです:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near 'DELIMITER %% CREATE TRIGGER insert_associated_inquiry
BEFORE UPDATE ON inquiry ' at line 1
このエラーの原因と解決策は何ですか。助けてください。ありがとう。