表说明:

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. CentOS 7 配置静态IP

    1.查看MAC地址 2.修改/etc/sysconfig/network-scripts/ifcfg-[第一步中红框内的文字] 3.添加和修改内容如下: 4.修改/etc/resolv.conf 5. ...

  2. 51nod1265 四点共面

    题目链接:51nod 1265 四点共面 四个点构成的三个向量a,b,c共面的充要条件是存在不全为零的实数x,y,z满足x*a+y*b+z*c=0,然后想到线代了.. 其实就是三个向量的混合积为0:( ...

  3. gulp教程之gulp-imagemin

    简介: 使用gulp-imagemin压缩图片文件(包括PNG.JPEG.GIF和SVG图片) 1.安装nodejs/全局安装gulp/本地安装gulp/创建package.json和gulpfile ...

  4. This Node源码分析

    看军哥博客有Rtos的源码分析,手痒耍宝把自己读的源码笔记分享出来.愿与众君互相讨论学习 namespace ros { namespace names { void init(const M_str ...

  5. CSS实现各种形状

    CSS3的一个非常酷的特性是允许我们创建各种规则和不规则形状的图形,从而可以减少图片的使用.以前只能在Photoshop等图像编辑软件中制作的复杂图形现在使用CSS3就可以完成了.通过使用新的CSS属 ...

  6. kettle 使用JAVA代码进行执行

    kettle 设计完成之后,可以在设计工具中进行调用,也可以使用java代码进行调用.   1.通过文件方式执行转换.   public static void runTransfer(String[ ...

  7. JQUERY MOBILE 中文API站 和 官方论坛

    中文API站:http://www.jqmapi.com/api1.2/preview/quickstartquide.html 官方论坛:http://bbs.phonegapcn.com/foru ...

  8. BlackBerry 9900刷机

    1.安装BlackBerry Desktop Software: 2.安装ROM,双击9900Asia_PBr7.1.0_rel2807_PL5.1.0.692_A7.1.0.1033_China_M ...

  9. 工作中用到的oracle字符串分割整理

    oracle部分: 定义类型(用于字符串分割): create or replace TYPE "STR_SPLIT" IS TABLE OF VARCHAR2 (4000); 字 ...

  10. 求最长回文子串:Manacher算法

    主要学习自:http://articles.leetcode.com/2011/11/longest-palindromic-substring-part-ii.html 问题描述:回文字符串就是左右 ...