表说明:

T_EXCEL_IMPORT_DATASRC: Excel数据存储表,(使用了xmltype存储Excel数据)

部分字段说明:

BUSINESSTYPE: Excel模板类型,一个Excel一个模板类型(非空)

EXPANDTYPE: 拓展类型,用于存储一些有用的业务数据,比如组织organ,用于等等.组织通常用来过滤展示数据的

XMLDATA: Excel数据

BUSINESSTYPE_sheet: 某一个Excel文件的第几个Sheet

T_EXCEL_IMPORT_GENERATION: 中间表,解析xmltype后的Excel数据

T_EXCEL_IMPORT_RULES: 规则表,即模板的规则

T_EXCEL_IMPORT_MAPCOLUMN: 字段映射表,Excel某一列对应的是某一Excel数据.比如: Cell1对应名称,Cell2对应性别

T_EXCEL_IMPORT_LOG: 日志记录表,操作错误日志记录表


序的创建:

-- Create sequence --错误日志主键序
create sequence SEQ_EXCEL_LOG
minvalue 1
maxvalue 999999999999999999999999999
start with 61
increment by 1
cache 20;

-- Create sequence --Excel数据序
create sequence SEQ_EXCEL_IMPROT
minvalue 1
maxvalue 9999999999999999999999999999
start with 157981
increment by 1
cache 20;


表的创建

-- Create table
create table T_EXCEL_IMPORT_DATASRC
(
id NUMBER not null,
businesstype VARCHAR2(20) not null,
expandtype VARCHAR2(20),
xmldata XMLTYPE
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table T_EXCEL_IMPORT_DATASRC
is 'excel导入数据业务表';
-- Add comments to the columns
comment on column T_EXCEL_IMPORT_DATASRC.id
is '主键';
comment on column T_EXCEL_IMPORT_DATASRC.businesstype
is '业务类型(不同Excel模板使用不同业务类型)';
comment on column T_EXCEL_IMPORT_DATASRC.expandtype
is '拓展类型';
comment on column T_EXCEL_IMPORT_DATASRC.xmldata
is 'Excel转换的xml数据';
-- Create/Recreate primary, unique and foreign key constraints
alter table T_EXCEL_IMPORT_DATASRC
add constraint PRI_EXCEL_IMPORT_DATASRC primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);

-- Create table
create table T_EXCEL_IMPORT_GENERATION
(
id NUMBER not null,
businessid NUMBER not null,
businesstype VARCHAR2(20) not null,
expandtype VARCHAR2(20),
errormsg VARCHAR2(500),
ucn VARCHAR2(500),
cell1 VARCHAR2(4000),
cell2 VARCHAR2(4000),
cell3 VARCHAR2(4000),
cell4 VARCHAR2(4000),
cell5 VARCHAR2(4000),
cell6 VARCHAR2(4000),
cell7 VARCHAR2(4000),
cell8 VARCHAR2(4000),
cell9 VARCHAR2(4000),
cell10 VARCHAR2(4000),
cell11 VARCHAR2(4000),
cell12 VARCHAR2(4000),
cell13 VARCHAR2(4000),
cell14 VARCHAR2(4000),
cell15 VARCHAR2(4000),
cell16 VARCHAR2(4000),
cell17 VARCHAR2(4000),
cell18 VARCHAR2(4000),
cell19 VARCHAR2(4000),
cell20 VARCHAR2(4000),
cell21 VARCHAR2(4000),
cell22 VARCHAR2(4000),
cell23 VARCHAR2(4000),
cell24 VARCHAR2(4000),
cell25 VARCHAR2(4000)
)
tablespace USERS
pctfree 5
initrans 1
maxtrans 255
storage
(
initial 16
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table T_EXCEL_IMPORT_GENERATION
is 'T_EXCEL_IMPORT_DATASRC生成的解析数据表';
-- Add comments to the columns
comment on column T_EXCEL_IMPORT_GENERATION.businessid
is '业务ID';
comment on column T_EXCEL_IMPORT_GENERATION.businesstype
is '数据类型=[业务类型+Sheet]';
comment on column T_EXCEL_IMPORT_GENERATION.expandtype
is '拓展类型';
comment on column T_EXCEL_IMPORT_GENERATION.errormsg
is '错误信息';
comment on column T_EXCEL_IMPORT_GENERATION.ucn
is '不同业务不同使用';
comment on column T_EXCEL_IMPORT_GENERATION.cell1
is 'Excel对应的列';
-- Create/Recreate indexes
create index INDEX_EXCEL_IMPORT_GENERA_1 on T_EXCEL_IMPORT_GENERATION (BUSINESSID)
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table T_EXCEL_IMPORT_GENERATION
add constraint PRI_EXCEL_IMPORT_GENERATION primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);

-- Create table
create table T_EXCEL_IMPORT_RULES
(
id NUMBER not null,
businesstype_sheet VARCHAR2(20) not null,
columnname VARCHAR2(20) not null,
columnenname VARCHAR2(20),
rule_empty VARCHAR2(1),
rule_range VARCHAR2(50),
rule_datetime VARCHAR2(1),
rule_date_customize VARCHAR2(20),
rule_unique VARCHAR2(1),
rule_phone VARCHAR2(1),
rule_number VARCHAR2(1),
rule_func_customize VARCHAR2(30),
rule_func_customize_msg VARCHAR2(200),
rule_idcard VARCHAR2(1),
procedure_name VARCHAR2(100)
)
tablespace USERS
pctfree 5
initrans 1
maxtrans 255
storage
(
initial 16
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table T_EXCEL_IMPORT_RULES
is 'Excel导入合法校验规则';
-- Add comments to the columns
comment on column T_EXCEL_IMPORT_RULES.businesstype_sheet
is '数据类型,(=业务类型+ _Sheet数)';
comment on column T_EXCEL_IMPORT_RULES.columnname
is 'Excel模板的列名';
comment on column T_EXCEL_IMPORT_RULES.columnenname
is '列名';
comment on column T_EXCEL_IMPORT_RULES.rule_empty
is '非空判断,1:非空,其余可空';
comment on column T_EXCEL_IMPORT_RULES.rule_range
is '大于另一列的值,格式:>=Excel中文标题名 或 >Excel中文标题名';
comment on column T_EXCEL_IMPORT_RULES.rule_datetime
is '日期/时间格式,1:日期或时间';
comment on column T_EXCEL_IMPORT_RULES.rule_date_customize
is '日期/时间格式, 用户自定义日期格式,如YYYY-MM或YYYY';
comment on column T_EXCEL_IMPORT_RULES.rule_unique
is '字段唯一,(如果有多个列唯一,表示这些列联合确定数据),唯一用来更新数据';
comment on column T_EXCEL_IMPORT_RULES.rule_phone
is '号码格式,1:手机号码,2:固话,3:手机或固话';
comment on column T_EXCEL_IMPORT_RULES.rule_number
is '数字格式:1:整数,2:整数或小数';
comment on column T_EXCEL_IMPORT_RULES.rule_func_customize
is '自定义函数名 (返回值1则表示合法),需要配合RULE_FUNC_CUSTOMIZE_MSG使用';
comment on column T_EXCEL_IMPORT_RULES.rule_func_customize_msg
is '自定义函数名校验不合格提示信息';
comment on column T_EXCEL_IMPORT_RULES.rule_idcard
is '身份证号码,1:合法身份证';
comment on column T_EXCEL_IMPORT_RULES.procedure_name
is '插入业务表数据的存储过程名字(至少得有一个值,多个值也可以,但是只会随机取一条数据)';
-- Create/Recreate primary, unique and foreign key constraints
alter table T_EXCEL_IMPORT_RULES
add constraint PRI_EXCEL_IMPORT_RULES primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
alter table T_EXCEL_IMPORT_RULES
add constraint UNI_EXCEL_IMPORT_RULES_1 unique (BUSINESSTYPE_SHEET, COLUMNNAME)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);

-- Create table
create table T_EXCEL_IMPORT_MAPCOLUMN
(
id NUMBER(10),
businesstype_sheet VARCHAR2(20),
columnenname VARCHAR2(20),
columncnname VARCHAR2(20)
)
tablespace USERS
pctfree 5
initrans 1
maxtrans 255
storage
(
initial 16
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table T_EXCEL_IMPORT_MAPCOLUMN
is 'Excel导入表头中文名对应的字段名';
-- Add comments to the columns
comment on column T_EXCEL_IMPORT_MAPCOLUMN.businesstype_sheet
is '规则类型 (业务类型+sheet数 合成的sheet规则类型)';
comment on column T_EXCEL_IMPORT_MAPCOLUMN.columnenname
is 'Excel表头字段对应的列名';
comment on column T_EXCEL_IMPORT_MAPCOLUMN.columncnname
is 'Excel表头字段中文名';

-- Create table
create table T_EXCEL_IMPORT_LOG
(
id NUMBER,
businessid NUMBER,
errorcode VARCHAR2(50),
errormsg VARCHAR2(1000),
errortype VARCHAR2(50),
line_no VARCHAR2(1000),
logdate DATE default sysdate
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table T_EXCEL_IMPORT_LOG
is '日志记录表';
-- Add comments to the columns
comment on column T_EXCEL_IMPORT_LOG.businessid
is '业务ID';
comment on column T_EXCEL_IMPORT_LOG.errorcode
is '错误码';
comment on column T_EXCEL_IMPORT_LOG.errormsg
is '错误描述';
comment on column T_EXCEL_IMPORT_LOG.errortype
is '错误类型,默认INFO';
comment on column T_EXCEL_IMPORT_LOG.line_no
is '错误行号';

oracle xmltype导入并解析Excel数据 (一)创建表与序的更多相关文章

  1. oracle xmltype导入并解析Excel数据 (五)中间表数据入库

    此处给出例子,具体根据业务需求 create or replace procedure P_CART_Sheet1(p_id in NUMBER) is--车辆管理功能v_str varchar2(4 ...

  2. oracle xmltype导入并解析Excel数据--前言

    通常,很多的时候,我们需要导入Excel数据到系统中,但是Excel数据需要我们去各种校验,比如身份证校验,手机号码校验等等. 校验失败的数据,提供Excel导出错误原因,提示给用户. 如此,如果校验 ...

  3. oracle xmltype导入并解析Excel数据 (四)特别说明

    1.Excel导出,此处没有给出 2.错误原因在中间表,T_EXCEL_IMPORT_GENERATION,其中errormsg不为空的数据 3,中间表入库过程: 需要自己实现,为一个存储过程,存储过 ...

  4. oracle xmltype导入并解析Excel数据 (三)解析Excel数据

    包声明 create or replace package PKG_EXCEL_UTILS is -- Author: zkongbai-- Create at: 2016-07-06-- Actio ...

  5. oracle xmltype导入并解析Excel数据 (二)规则说明

    规则表字段说明如下: 其中RULE_FUNC_CUSTOMIZE表示,用户自己写函数,去判断数据是否合法,存储的是函数的名字 此函数的参数只有一个,该列的值,字段类型是Varchar2, 校验失败的话 ...

  6. 利用 js-xlsx 实现 Excel 文件导入并解析Excel数据成json格式的数据并且获取其中某列数据

    演示效果参考如下:XML转JSON 另一个搭配SQL实现:http://sheetjs.com/sexql/index.html 详细介绍: 1.首先需要导入js <script src=&qu ...

  7. 解析Excel数据

    解析Excel数据常用的方式就是使用POI和JXL工具了,这两种工具使用起来有些类似,这里记录一下使用方式提供个参考 POI使用 File file = new File(filePath); Fil ...

  8. Oracle 导出、导入某用户所有数据(包括表、视图、存储过程...)

    Oracle 导出.导入某用户所有数据(包括表.视图.存储过程...)前提:在CMD 命令下 导出命令:exp 用户名/密码@数据库 owner=用户名 file=文件存储路径(如:F:\abcd.d ...

  9. POI完美解析Excel数据到对象集合中(可用于将EXCEL数据导入到数据库)

    实现思路: 1.获取WorkBook对象,在这里使用WorkbookFactory.create(is); // 这种方式解析Excel.2003/2007/2010都没问题: 2.对行数据进行解析 ...

随机推荐

  1. TcpListener 类

    构造函数       名称 说明 TcpListener(IPAddress, Int32) 新实例初始化 TcpListener 类用于侦听传入的连接尝试在指定的本地 IP 地址和端口号. TcpL ...

  2. 如何使用Notepad++编译运行php

    安装编译运行文件的插件.插件-Plugin Manager-Show Plugin Manager. 找到NppExec插件,从这个插件的名字来看就是各位文件的执行.点击Install.需要下载安装, ...

  3. kaggle数据挖掘竞赛初步--Titanic<数据变换>

    完整代码: https://github.com/cindycindyhi/kaggle-Titanic 特征工程系列: Titanic系列之原始数据分析和数据处理 Titanic系列之数据变换 Ti ...

  4. ueditor使用小结

    一.简介 ueditor是百度编辑器,官网地址:http://ueditor.baidu.com/website/ 完整的功能演示,可以参考:http://ueditor.baidu.com/webs ...

  5. http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html(转载)(原作者:AstralWind)

      Python正则表达式指南   本文介绍了Python对于正则表达式的支持,包括正则表达式基础以及Python正则表达式标准库的完整介绍及使用示例.本文的内容不包括如何编写高效的正则表达式.如何优 ...

  6. [转]MYSQL高可用方案探究(总结)

    前言 http://blog.chinaunix.net/uid-20639775-id-3337432.htmlLvs+Keepalived+Mysql单点写入主主同步高可用方案 http://bl ...

  7. php简写表达式,&& or || 缩写条件语句

    有时候学的多了, 好多小细节 都忘了 ,比如 简单的表达式, 三元表达式   ?:; $aa or $bb 表达式 等等! 写一些简单的表达式,备忘! php用&&和||缩写条件语句 ...

  8. cacti web页面访问 settings出错

    查看apache错误日志: 错误信息Mon Dec 26 11:00:48.241653 2016] [:error] [pid 32607] [client 192.168.10.79:65009] ...

  9. DNS bind子域授权安装

    失败经验:rhel 6.x bind 9.8,两台做子域授权,最后失败.原因不详. 改用rhel 5.5, bind 9.3,同样的配置,就成功了.具体记录一下9.3的配置. 安装:采用安装RHEL时 ...

  10. [暴力搜索] POJ 3087 Shuffle'm Up

    Shuffle'm Up Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10003   Accepted: 4631 Des ...