insert into base_project (id,customer_id,project_code,project_name,project_stage,short_code,business_code,project_star,project_proline,plm_out_date,remarks,
strategy,product_line,product_range,
productline_type)
select t.project_id,t2.id,t.project_code, t.project_name,t.project_stage,'','',t.project_star,t.project_proline,t.out_date,t.project_cus,
SUBSTR (t.product_category,0,instr(t.product_category,'|', 1, 1)-1),
SUBSTR (t.product_category,instr(t.product_category,'|', 1, 1)+1,(instr(t.product_category,'|', 1, 2)-1-instr(t.product_category,'|', 1, 1))),
sUBSTR (t.product_category,instr(t.product_category,'|', 1, 2)+1,(length(t.product_category)-instr(t.product_category,'|', 1, 2))),
t.productline_type
from plm_original_data t
left join base_customer t2 on t2.customer_name=t.project_cus
where not exists( select 1 from base_project t1 where t1.project_code = t.project_code )
and t.project_code <>'null';