我收到以下错误,虽然我试过谷歌,但没有找到解决方案。 Mysql workbench版本是6.2; Mysql版本是5.6.21。
CREATE DEFINER=`developer`@`%` PROCEDURE `sp_tr069_update_performance_performanceinventory_test`(
in temp_db varchar(256),
in nocout_db varchar(256)
)
BEGIN
declare sys_time_in_current_table int ;
declare sys_time_in_perf_inventory_status int;
set @temporary_query = concat('set sys_time_in_current_table = (select sys_timestamp from ',temp_db,'.','performance_performanceinventory limit 1 )');
PREPARE stmt from @temporary_query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
set @temporary_query1 = concat('set sys_time_in_perf_inventory_status = (select sys_timestamp from ',nocout_db,'.performance_inventorystatus order by id desc limit 1) ;');
PREPARE stmt1 from @temporary_query1;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
set @temporary_query=NULL;
-- set @temporary_query=concat();
-- prepare stmt from ;
select `sys_time_in_current_table`,`sys_time_in_perf_inventory_status`;
IF `sys_time_in_current_table`>`sys_time_in_perf_inventory_status`
THEN
select 1;
set @temporary_query2 =
concat('UPDATE ', nocout_db,'.`performance_inventorystatus` inv_status
INNER JOIN ', temp_db,'.`performance_performanceinventory` perf_inv on
inv_status.device_name=perf_inv.device_name and
inv_status.service_name=perf_inv.service_name and
inv_status.data_source=perf_inv.data_source
SET
inv_status.device_name=perf_inv.`device_name` ,
inv_status.service_name=perf_inv.`service_name` ,
inv_status.machine_name=perf_inv.`machine_name` ,
inv_status.site_name=perf_inv.`site_name` ,
inv_status.ip_address=perf_inv.`ip_address` ,
inv_status.data_source=perf_inv.`data_source` ,
inv_status.severity=perf_inv.`severity` ,
inv_status.current_value=perf_inv.`current_value` ,
inv_status.min_value=perf_inv.`min_value` ,
inv_status.max_value=perf_inv.`max_value` ,
inv_status.avg_value=perf_inv.`avg_value` ,
inv_status.warning_threshold=perf_inv.`warning_threshold` ,
inv_status.critical_threshold=perf_inv.`critical_threshold` ,
inv_status.sys_timestamp=perf_inv.`sys_timestamp` ,
inv_status.check_timestamp=perf_inv.`check_timestamp`;') ;
PREPARE stmt2 from @temporary_query2;
EXECUTE stmt2;
DEALLOCATE PREPARE stmt2;
set @temporary_query3 = concat('INSERT INTO ',nocout_db,'.`performance_inventorystatus`
(
`device_name`,
`service_name`,
`machine_name`,
`site_name`,
`ip_address`,
`data_source`,
`severity`,
`current_value`,
`min_value`,
`max_value`,
`avg_value`,
`warning_threshold`,
`critical_threshold`,
`sys_timestamp`,
`check_timestamp`)
SELECT
`performance_performanceinventory`.`device_name`,
`performance_performanceinventory`.`service_name`,
`performance_performanceinventory`.`machine_name`,
`performance_performanceinventory`.`site_name`,
`performance_performanceinventory`.`ip_address`,
`performance_performanceinventory`.`data_source`,
`performance_performanceinventory`.`severity`,
`performance_performanceinventory`.`current_value`,
`performance_performanceinventory`.`min_value`,
`performance_performanceinventory`.`max_value`,
`performance_performanceinventory`.`avg_value`,
`performance_performanceinventory`.`warning_threshold`,
`performance_performanceinventory`.`critical_threshold`,
`performance_performanceinventory`.`sys_timestamp`,
`performance_performanceinventory`.`check_timestamp`
FROM ', temp_db,'.`performance_performanceinventory`
left join ', nocout_db,'.performance_inventorystatus inv_status on
performance_performanceinventory.device_name=inv_status.device_name and
performance_performanceinventory.service_name=inv_status.service_name and
performance_performanceinventory.data_source=inv_status.data_source
where inv_status.device_name is null ;');
PREPARE stmt3 from @temporary_query3;
EXECUTE stmt3;
DEALLOCATE PREPARE stmt3;
set @temporary_query4 = concat('INSERT INTO', nocout_db,'.`performance_performanceinventory`
(
`device_name`,
`service_name`,
`machine_name`,
`site_name`,
`ip_address`,
`data_source`,
`severity`,
`current_value`,
`min_value`,
`max_value`,
`avg_value`,
`warning_threshold`,
`critical_threshold`,
`sys_timestamp`,
`check_timestamp`)
SELECT
`performance_performanceinventory`.`device_name`,
`performance_performanceinventory`.`service_name`,
`performance_performanceinventory`.`machine_name`,
`performance_performanceinventory`.`site_name`,
`performance_performanceinventory`.`ip_address`,
`performance_performanceinventory`.`data_source`,
`performance_performanceinventory`.`severity`,
`performance_performanceinventory`.`current_value`,
`performance_performanceinventory`.`min_value`,
`performance_performanceinventory`.`max_value`,
`performance_performanceinventory`.`avg_value`,
`performance_performanceinventory`.`warning_threshold`,
`performance_performanceinventory`.`critical_threshold`,
`performance_performanceinventory`.`sys_timestamp`,
`performance_performanceinventory`.`check_timestamp`
FROM ', temp_db,'.`performance_performanceinventory` ;');
PREPARE stmt4 from @temporary_query4;
EXECUTE stmt4;
DEALLOCATE PREPARE stmt4;
set @temporary_query5 = concat('Truncate ', temp_db,'.`performance_performanceinventory`');
PREPARE stmt5 from @temporary_query5;
EXECUTE stmt5;
DEALLOCATE PREPARE stmt5;
END IF;
END
当我执行这个存储过程时,它完成了.... 但是当我调用这个程序时它的抛出运行时错误....
call nocout_bhutan_testing.sp_tr069_update_performance_performanceinventory_test('tr069_temp_machine_1', 'nocout_bhutan_testing');