PLSQL同时执行多条语句实例
/*建表*/
/*创建表TBSLSWDICTTHEMETYPE*/
/*创建表TBSLSWDICTTHEMETYPE*/
-- Create table
create table TBSLSWDICTTHEMETYPE
(
themetypeguid VARCHAR2(50) not null,
themetypename VARCHAR2(200) not null,
themetypecode VARCHAR2(100) not null,
parentguid VARCHAR2(50),
themelevel NUMBER(4) not null,
showorderid NUMBER(4) not null,
isused NUMBER(4) not null,
remark NVARCHAR2(2000)
)
tablespace SZSLSYS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 8
minextents 1
maxextents unlimited
)
nologging;
-- Add comments to the columns
comment on column TBSLSWDICTTHEMETYPE.themetypeguid
is 'GUID';
comment on column TBSLSWDICTTHEMETYPE.themetypename
is '专题类型名称,不能重复,例如:河湖基本情况';
comment on column TBSLSWDICTTHEMETYPE.themetypecode
is '用户程序编码,编号规则:SL+“专题名称拼音首字母”例如:SLHH,表示“河湖基本情况”,专题类型代码不能重复';
comment on column TBSLSWDICTTHEMETYPE.parentguid
is '父级专题GUID,为空表示最顶层';
comment on column TBSLSWDICTTHEMETYPE.themelevel
is '当前处于哪个等级';
comment on column TBSLSWDICTTHEMETYPE.showorderid
is '流水号,用来调整专题数据列表时的显示顺序';
comment on column TBSLSWDICTTHEMETYPE.isused
is '是否启用:
0:未启用
1:已启用
';
-- Create/Recreate primary, unique and foreign key constraints
alter table TBSLSWDICTTHEMETYPE
add constraint PK_THEMETYPEGUID primary key (THEMETYPEGUID)
using index
tablespace SZSLSYS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
alter table TBSLSWDICTTHEMETYPE
add constraint U_THEMETYPECODE unique (THEMETYPECODE)
using index
tablespace SZSLSYS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
alter table TBSLSWDICTTHEMETYPE
add constraint U_THEMETYPENAME unique (THEMETYPENAME)
using index
tablespace SZSLSYS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
alter table TBSLSWDICTTHEMETYPE
add constraint FK_THEMETYPEGUID_THEMETYPEGUID foreign key (PARENTGUID)
references TBSLSWDICTTHEMETYPE (THEMETYPEGUID);
/*创建表TBSLSWDATAIMPORTLOG*/
-- Create table
create table TBSLSWDATAIMPORTLOG
(
logguid VARCHAR2(50) not null,
themetypeguid VARCHAR2(50) not null,
processstate NUMBER(4) not null,
logcontent NVARCHAR2(2000) not null,
submitdepartment NVARCHAR2(100),
submittime DATE,
sourcefilename VARCHAR2(100) not null,
sourcedataformat NUMBER(4) not null,
reccount NUMBER(4) not null,
datarange VARCHAR2(100),
tempdsname VARCHAR2(40) not null,
tempfcname VARCHAR2(40) not null,
intemplibtime DATE,
currdsname VARCHAR2(40) not null,
currfcname VARCHAR2(40) not null,
intemplibmodel NUMBER(2) not null,
incurrlibmodel NUMBER(2) not null,
incurrlibtime DATE
)
tablespace SZSLSYS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 1
minextents 1
maxextents unlimited
)
nologging;
-- Add comments to