存储过程系列三:根据表别名方式distinct去重插入
1、根据表别名方式distinct去重插入
insert into GG_XKZ_YLQXSCXKESL_SCDZ
( bzj, xkzid, sqid, jtdz, szsf, szqx, szjd, lxdh, yb, instnum, lastdate, datexc)
select SYS_GUID(), new_xkz_idIn, a.* from
(select distinct sqid, jtdz, szsf, szqx, szjd, lxdh, yb, f_getslbs(), sysdate, '11'
from XZXK_YLQXSCXKESL_BG_SCDZ
where sqid = sqidIn and bgqhbs = '2' ) a;