1. show create procedure
2. 两个系统表
information_schema.routines 可查询出存储过程的内容,但是入参和出参没包含
information_schema.PARAMETERS 可查询入参和出参
select concat(p1,ifnull(p2,''),p3) routine_definition
from
(
select
concat(case when a.routine_definition is not null then concat('create procedure ',a.specific_name,'(') end) p1,group_concat(concat(b.parameter_mode,' ',b.parameter_name,' ',b.dtd_identifier)) p2,
concat(') ',a.routine_definition) p3
from information_schema.routines a
join INFORMATION_SCHEMA.PARAMETERS b
on a.SPECIFIC_NAME=b.SPECIFIC_NAME and a.routine_schema=b.specific_schema
-- 传入待查询的数据库
and a.routine_schema='dw'
-- 传入待查询的存储过程名
and a.SPECIFIC_NAME = 'ads_medical_stk_detail_detail'
group by a.SPECIFIC_NAME
)t
每天进步一点点
浙公网安备 33010602011771号