drop procedure if EXISTS p_calc_item_last_step//
create PROCEDURE p_calc_item_last_step(in in_from_table_name varchar(255) , out result varchar(255) )
BEGIN
DECLARE start_time datetime;
DECLARE end_time datetime;
DECLARE temp_types INTEGER(4);
select types into temp_types from analysis_configs where from_table_name = in_from_table_name;
select DATE_FORMAT(now(),"%Y-%m-%d %H:00:00") into end_time;
if temp_types<11 then
set start_time = DATE_FORMAT(SUBDATE(now(), INTERVAL 1 hour), "%Y-%m-%d %H:00:00");
else
set start_time = DATE_FORMAT(SUBDATE(now(), INTERVAL 1 day), "%Y-%m-%d 00:00:00");
set end_time = DATE_FORMAT(end_time, "%Y-%m-%d 00:00:00");
end if;
plantegg (未验证)
周一, 2007/09/17 - 10:59
Permalink
drop procedure if EXISTS
drop procedure if EXISTS p_calc_item_last_step//
create PROCEDURE p_calc_item_last_step(in in_from_table_name varchar(255) , out result varchar(255) )
BEGIN
DECLARE start_time datetime;
DECLARE end_time datetime;
DECLARE temp_types INTEGER(4);
select types into temp_types from analysis_configs where from_table_name = in_from_table_name;
select DATE_FORMAT(now(),"%Y-%m-%d %H:00:00") into end_time;
if temp_types<11 then
set start_time = DATE_FORMAT(SUBDATE(now(), INTERVAL 1 hour), "%Y-%m-%d %H:00:00");
else
set start_time = DATE_FORMAT(SUBDATE(now(), INTERVAL 1 day), "%Y-%m-%d 00:00:00");
set end_time = DATE_FORMAT(end_time, "%Y-%m-%d 00:00:00");
end if;
select start_time, end_time;
result = "successful";
end;
游客 (未验证)
周四, 2009/04/16 - 14:56
Permalink
如果用C程序来调用该
如果用C程序来调用该存储过程,如何获得result的值??请指教····