insert into alarm(id,adesk_alarm_id,serial_no,level,source,type,advice_id,create_time,upload_time,order_id,title,location,customer_id)
values (null,1,'aaa',1,1,1,1,123456789,123456789,1,'title','location',1);
insert into syslogalarm (id,description,reason,advise,log_content,original_log_id,alarm_id) values(null,'aaa',null,null,null,1,(select id from alarm where adesk_alarm_id=1));
我现在需要一起运行这两条sql,但是一起运行的时候会报错,错误信息:
SQL execution error #1064,Response from the database;
单元测试报错:
java.sql.BatchUpdateException:Query was empty.
sql语句错了,你的不支持多条sql语句吧;
第二句里面用了第一句的表,被锁了,试试下面这样
insert into syslogalarm (id,description,reason,advise,log_content,original_log_id,alarm_id) values(null,'aaa',null,null,null,1,(select id from alarm with(nolock) where adesk_alarm_id=1));