从word得到表格数据插入数据库(6位行业代码)
复制表格到excel
点击表格左上角选中全部表格,然后crtl+c,再贴到excel中

可以发现,大类代码,单元格往下走,碰到下一个有值的之前,都是上一个的范围

填充空白单元格
1.选中前四列,然后ctrl+g定位空白表格

2.按住ctrl,点击有值的下一个单元格,写入等于上一个单元格的公式,然后ctrl+enter

写插入数据库语句
最好写成insert into values(1, 2, 3), (1, 2, 3);
但Oracle不支持

最好双击写公式的单元格,然后复制,得到sql如下
数据太多直接崩了

oracle命令行导入sql文件
1.建表,字段值远大于实际值,防止空格这些引起超长度
-- Create table
create table INDUSTRY
(
code1 VARCHAR2(),
code2 VARCHAR2(),
code3 VARCHAR2(),
code4 VARCHAR2(),
code5 VARCHAR2(),
industry_name VARCHAR2()
)
tablespace SYSTEM
pctfree
pctused
initrans
maxtrans
storage
(
initial 64K
next 1M
minextents
maxextents unlimited
);
-- Add comments to the columns
comment on column INDUSTRY.code1
is '1位代码';
comment on column INDUSTRY.code2
is '2位代码';
comment on column INDUSTRY.code3
is '3位代码';
comment on column INDUSTRY.code4
is '4位代码';
comment on column INDUSTRY.code5
is '6位代码';
comment on column INDUSTRY.industry_name
is '行业名称';
2.打开cmd窗口,输入命令如下:sqlplus username/password@ip:port/实例名
3.@C:\Users\user\Downloads\6位行业代码插入\2.sql(你的文件的位置)


去除空格
update industry set
code1 = trim(code1),
code2 = trim(code2),
code3 = trim(code3),
code4 = trim(code4),
code5 = trim(code5),
industry_name = trim(industry_name)

处理不合格数据
可发现,code2,code3,code4应该为code5的前几位
通过sql找出不合格的数据
select * from industry
where length(code5)=
and (
substr(code5,,)!=code2
or substr(code5,,)!=code3
or substr(code5,,)!=code4
)

执行更新sql
update industry set
code2 = substr(code5,,),
code3 = substr(code5,,),
code4 = substr(code5,,)
where length(code5)=
and (
substr(code5,,)!=code2
or substr(code5,,)!=code3
or substr(code5,,)!=code4
)
不合格数据2
select * from industry
where length(code4)=
and (
substr(code4,,)!=code2
or substr(code4,,)!=code3
)
更正sql
update industry set
code2 = substr(code4,,),
code3 = substr(code4,,)
where length(code4)=
and (
substr(code4,,)!=code2
or substr(code4,,)!=code3
)
处理填充过来的标题跟0
select * from industry
where length(code2)!=
or length(code3)!=
or length(code4)!=
or length(code1)!=
for update

更正为

从word得到表格数据插入数据库(6位行业代码)的更多相关文章
- Ajax实现xml文件数据插入数据库(一)--- 构建解析xml文件的js库
Ajax实现将xml文件数据插入数据库的过程所涉及到的内容比较多,所以对于该过程的讲解本人打算根据交互的过程将其分为三个部分,第一部分为构建解析xml文件的javascript库,第二部分为ajax与 ...
- Ajax实现xml文件数据插入数据库(二)--- ajax实现与jsp的数据交互。
在上一篇文章中我们成功得到了重新组织后的数据,接下来需要做的便是将数据插入到数据库中了.在与数据库打交道的过程中有一些方法是普遍的,我们将这些通用方法封装到一个DbUtil类中,以便复用,封装好的Db ...
- mysql 带换行符的字符串数据插入数据库异常
带换行符的字符串数据插入数据库异常现象 某个字符串类型的字段中部分记录中带换行符,数据同步插入异常,提示如下类似警告信息: Incorrect string value:'<aherf=&quo ...
- excel的表格数据插入到数据库
看到有excel保存insert的数据,自己照着教程弄了一下,可以的. 表格数据 接下来我们在d3的位置输入 =CONCATENATE("insert into user(code, nam ...
- 使用Python将数据插入数据库(一)
假如我现在有一个Excel数据表格,需要将其数据插入MySQL数据库中.数据如下: 对应的Python实现代码如下: #导入需要使用到的数据模块 import pandas as pd import ...
- C/s从文件(TXT)中读取数据插入数据库
流程: 1.当按钮单击时,弹出OpenFileDialog 2.判断后缀名是否合法 3.导入数据库 按钮事件中的代码: 1.判断用户是否选中文件. 2.判断用户选择的文件是否为txt //第一步,当按 ...
- c# 使用SqlBulkCopy 提高大数据插入数据库速度
自己得一点总结: 1.BulkCopy采用的是插入方式,不是覆盖方式(原数据不动,在原数据的后面复制上dataTable中的内容) 2.自增的字段不用赋值 3.数据库字段名和dataTable列名可以 ...
- 模拟ATM机将输入的数据插入数据库
ATM抽象类 public abstract class ATM { private double balance; private String idcard; private String pas ...
- ASP.NET MVC与Sql Server交互,把字典数据插入数据库
在"ASP.NET MVC与Sql Server交互, 插入数据"中,在Controller中拼接sql语句.比如: _db.InsertData("insert int ...
随机推荐
- ElasticSearch5.4.1 搜索引擎搭建文档
安装配置JDK环境JDK安装(不能安装JRE)JDK下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-download ...
- android 异常信息The specified child already has a parent. You must call removeView() on the child's parent first. 的处理方法
[Android异常信息]: The specified child already has a parent. You must call removeView() on the child's p ...
- [luogu1452]Beauty Contest【凸包+旋转卡壳】
题目大意 求出平面最远点对距离的平方. 分析 此题我wa了好久,第一是凸包写错了,后面又是旋转卡壳写错了..自闭3s. 题解应该是旋转卡壳,但是有人用随机化乱搞过掉了Orz. 讲讲正解. 我们先求出所 ...
- 「HNOI2016」树 解题报告
「HNOI2016」树 事毒瘤题... 我一开始以为每次把大树的子树再接给大树,然后死活不知道咋做,心想怕不是个神仙题哦 然后看题解后才发现是把模板树的子树给大树,虽然思维上难度没啥了,但是还是很难写 ...
- C/C++ 控制台窗口暂停
为什么我看不到控制台的输出结果? 在编写C++程序中,经常会出现,控制台窗口一闪就消失了的情况 为什么会这样? 原因简单到有点可笑:因为程序运行结束了 对于控制台程序,操作系统让它开始运行前会为它造一 ...
- pip无法正常使用卸载并重新安装
错误提示 ➜ ~ pip Traceback (most recent call last): File "/usr/bin/pip", line 11, in <modul ...
- [hdu5215][Cycle]
题目链接 思路 首先可以通过二分图染色找到奇环和一部分偶环.这个比较简单 但是还有一种偶环容易忽略. 如图(别问我为啥没节点4) 第一次可以找到1-2-3-1)这个奇环,第二次可以找到(3-5-6-3 ...
- jokes
先看效果如下 目录如下 //index.html <!DOCTYPE html> <html lang="zh-CN"> <head> < ...
- python enumarate方法的使用
'''enumerate() 函数用于将一个可遍历的数据对象(如列表.元组或字符串)组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中.'''
- http请求流程
