sql语句做数据初始化(科创)

delete from td_project_integral where appraise_id='1';

--pk
create sequence SEQ_GYX10
minvalue 1000
maxvalue 9999
start with 1000
increment by 1
cache 20;

--cid
create sequence SEQ_GYX11
minvalue 1000
maxvalue 9999
start with 1000
increment by 1
cache 20;


--pkid
select '1'||to_char(sysdate,'yyyymmdd')||SEQ_GYX10.Nextval from dual;
--cid
select SEQ_GYX11.Nextval||'p1' from dual;

select * from td_project_integral;
  

insert into TD_PROJECT_INTEGRAL
select '1'||to_char(sysdate,'yyyymmdd')||SEQ_GYX10.Nextval pk_id,SEQ_GYX11.Nextval||'p1',
a.*,b.* from
(select project_id PROJECT_ID ,project_name PROJECT_NAME ,project_manager_name PROJECT_MANAGER_NAME,
project_manager_id PROJECT_MANAGER_ID
from td_phases_info where state='3' group by project_id,project_name,
project_manager_name,project_manager_id) a,
(select context_name CONTEXT_NAME,appraise_name APPRAISE_NAME,persent_score PERSENT_SCORE,
appraise_base_score APPRAISE_BASE_SCORE,appraise_way APPRAISE_WAY,integral_rule INTEGRAL_RULE,appraise_id APPRAISE_ID
from TD_INTEGRAL_PARAMETER where appraise_id='1') b;

commit;

你可能感兴趣的:(sql,cache)