if object_id('[tb]') is not null
drop table [tb]
go
create table [tb]([id] int,[col1] varchar(8),[col2] int)
insert [tb]
select 1,'河北省',0 union all
select 2,'邢台市',1 union all
select 3,'石家庄市',1 union all
select 4,'张家口市',1 union all
select 5,'南宫',2 union all
select 6,'坝上',4 union all
select 7,'任县',2 union all
select 8,'清河',2 union all
select 9,'河南省',0 union all
select 10,'新乡市',9 union all
select 11,'aaa',10 union all
select 12,'bbb',10
;with t as(
select * from [tb] where col1='河北省' union all select a.* from [tb] a ,t where a.col2=t.id
)
select * from t
准备工作:数据清洗。检查数据类型和表中的字段类型是否匹配;检查空值约束;去无关空格等。这些检查工作可以通过Excel的数据筛选功能,看一下每个字段所有的值,再选中不合规范的进行修改。
步骤:
1)登录pl/sql developer,登录时选择待导入表所在数据库,在查询窗口里输入sele ......