做一个主键id,他为序列生成,而且其必须为7为数字,如果不太够,则使用0补充!
create or replace function fn_get_Personid -- 个人信息采集:获取7位的id值
(
id in varchar2 -- 无用
)
return varchar2 is
t_id varchar2(10); -- 要返回的信息Id
begin
select SEQ_HR_PERSON_ID.Nextval
into t_id
from dual; -- 查询序列
if length(t_id)=6 then
t_id:='0'||t_id;
elsif length(t_id)=5 then
t_id:='00'||t_id;
elsif length(t_id)=4 then
t_id:='000'||t_id;
elsif length(t_id)=3 then
t_id:='0000'||t_id;
elsif length(t_id)=2 then
t_id:='00000'||t_id;
elsif length(t_id)=1 then
t_id:='000000'||t_id;
end if;
return(t_id); -- 返回处理后的数据
end fn_get_Personid;
注意使用pl/sql中自动自动生成的工具!
4409

被折叠的 条评论
为什么被折叠?



