1、mysql存储过程,可以实现动态表读取,满足较为复杂的业务逻辑
DROP PROCEDURE if exists p_get_car_trace;
delimiter //
CREATE PROCEDURE p_get_car_trace()
begin
declare var_sql varchar(800);
declare var_tabe_name varchar(50);
set var_tabe_name = 'geom1';
set var_sql = concat_ws(' ', 'select id,AsText(geo) geo from ', var_tabe_name);
set @sql = var_sql;
PREPARE s1 from @sql;
EXECUTE s1;
deallocate prepare s1;
end //
delimiter ;
2、sql server存储过程,使用执行sql语句的脚步步骤,实现数据的逐行调用
create proc p_ins_test
(@id int,
@geo nvarchar(max)
)
as
begin
insert into t_test(id,geo)
values(@id,@geo);
end
3、抽取过程流程图:
表输入:
执行sql语句步骤,使用参数传递上步骤的值