首页 > 代码库 > 个人笔记-oracle

个人笔记-oracle


序列

select * from user_sequences 
select last_number from user_sequences where sequence_name='T_JGXX_POLY_SEQ';
alter sequence T_JGXX_POLY_SEQ increment by 1;
SELECT T_JGXX_POLY_SEQ.NEXTVAL FROM DUAL;


Meger

merge into t_jgxx_poly jg
using t_jgxx_poly_view v
on (jg.id=v.id and v.geometry is not null)
WHEN MATCHED THEN  
update set jg.geometry = v.geometry
WHEN NOT MATCHED THEN   
INSERT  (id,geometry) values(v.id,v.geometry)


view

create or replace view t_jgxx_poly_view as
select xz.geometry,jg.id from t_jgxx jg, XZQH_CNTY_POLY xz where jg.xzqh=xz.cnty_code and xz.geometry is not null
union all
select xz.geometry,jg.id from t_jgxx jg, XZQH_PREF_POLY xz where jg.xzqh=TO_CHAR(xz.PREF_CODE) and xz.geometry is not null
union all
select xz.geometry,jg.id from t_jgxx jg, XZQH_PROVINCE_POLY xz where jg.xzqh=TO_CHAR(xz.PROV_CODE) and xz.geometry is not null;


个人笔记-oracle