一:修改字段类型
--第一步:添加一个clob类型的字段
alter table top_event add (err_msg1 clob);
--第二部:将原来字段的值拷贝到新建的clob字段
update top_event set err_msg1 = err_msg;
--第三步:删除原来的字段
alter table top_event drop column err_msg;
--第四步:将新建的clob字段的名字修改为原来的字段的名字
alter table top_event rename column err_msg1 to err_msg;
二:截取字段
create or replace procedure pd_joinrole_add --添加经销商角色关联信息
(
user_id in integer, --操作人id
l_joinid in varchar, --加盟商id
l_roles in varchar, --供应商可使用角色id字符串
l_adminroles in varchar, --供应商超级管理员角色id字符串
l_userid in varchar --用户
)
is
w_userroleid integer; --用户角色主键id
w_joinroleid integer; --供应商角色主键id
begin
for item in (SELECT REGEXP_SUBSTR(l_adminroles,'[^,]+',1,level) AS roleid FROM DUAL connect by level<=length(l_adminroles)-length(replace(l_adminroles,',',''))+1) loop
pd_get_id('org_userrole',1,w_userroleid,'');
insert into org_userrole(id,userid,roleid,createuserid,modifyuserid) values(w_userroleid,l_userid,item.roleid,user_id,user_id);
end loop;
for item in (SELECT REGEXP_SUBSTR(l_roles,'[^,]+',1,level) AS roleid FROM DUAL connect by level<=length(l_roles)-length(replace(l_roles,',',''))+1) loop
pd_get_id('org_joinrole',1,w_joinroleid,'');
insert into org_joinrole(id,roleid,joinid,createuserid,modifyuserid,flagdelete)
values(w_joinroleid,item.roleid,l_joinid,user_id,user_id,0);
end loop;
end pd_joinrole_add;
三:查询自增序列
select * from user_sequences;