表说明:

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. Json.net 常用使用小结

    using System; using System.Linq; using System.Collections.Generic; namespace microstore { public int ...

  2. Python【2】-列表和元组

    一.序列 python包含六种内建的序列:列表.元组.字符串.unicode字符串.buffer对象.xrange对象. 列表可以修改,元组是不能修改的. 二.列表 列表list是变长序列,其中的内容 ...

  3. img标签 加载FTP的图片 C#

    好吧,我是菜鸟,这是我今天遇到的问题,什么也不会,得高人指点 1.使用FtpWebRequest下载图片,以流存贮 2.在ashx文件里面直接已流方式(HttpContext.Current.Resp ...

  4. uiimage 上传 数据库

    之前我所接触的上传图片都是直接与服务器交互的,即 app端要做的就是上传到服务器 现在这个项目却是app先上传到"数据库",由"数据库"传到服务端 下面说主题 ...

  5. 全面分析Java的垃圾回收机制

    Java的堆是一个运行时数据区,类的实例(对象)从中分配空间.Java虚拟机(JVM)的堆中储存着正在运行的应用程序所建立的所有对象,这些对象通过new.newarray.anewarray和mult ...

  6. [转载]什么是FCKeditor?功能强大的HTML编辑器!

    天天在用FCKeditor写博客,但一直不清楚FCKeditor到底是什么,今天终于找到了一些相关的资料,大家一起来分享下. FCKeditor文本编辑程序(共享软件)为用户提供在线的文档编辑服务,其 ...

  7. WinPipe后门程序代码示例(仅限技术交流)

    具体怎么编译,生成执行程序,不懂得先学习C++程序代码编译和集成开发环境. 多的不说了,只有两个代码文件,一个头文件,一个源文件.不多说了,直接上干货. (恶意使用,或者商用,后果自负,与本人无关.) ...

  8. IOS Core Animation Advanced Techniques的学习笔记(三)

    第四章:Visual Effects   Rounded Corners 例子4.1 cornerRadius 源码在这里下载:http://www.informit.com/title/978013 ...

  9. Pythonn 内置函数

    abs 绝对值 n = abs(-1) print(n) ========================= /usr/bin/python3.5 /home/liangml/pythonscript ...

  10. android 打包失败

    如果在打包时提示: proguard returned with error code 1   并且在控制台中输出:'java'不是内部或外部程序或批处理文件 那么就说明你的环境变量出问题了,之前用的 ...