存储过程
来源:互联网 发布:天下三捏脸数据男 编辑:程序博客网 时间:2024/06/14 22:05
spool elb.log
set sqlblanklines on
set feedback off
set define off
set serveroutput on
-- ---------------------------------------- USER_T ----------------------------------------
prompt create table USER_T ...
-- If the table is exists,drop it ...
DECLARE
v_table_exists number := 0;
BEGIN
select count(1) into v_table_exists
from user_tables t
where t.TABLE_NAME = 'USER_T';
dbms_output.put_line('USER_T v_table_exists: ' || v_table_exists);
if(v_table_exists > 0) then
execute immediate 'drop table USER_T';
end if;
END;
/
-- If the primary key is exists,drop it ...
DECLARE
v_pk_exists number := 0;
BEGIN
select count(1) into v_pk_exists
from USER_CONSTRAINTS t
where t.TABLE_NAME = 'USER_T' and t.CONSTRAINT_NAME = 'USER_PK';
dbms_output.put_line('USER_T v_pk_exists: ' || v_pk_exists);
if(v_pk_exists > 0) then
execute immediate 'alter table USER_T drop constraint USER_PK';
end if;
END;
/
-- Create table
create table USER_T
(
id VARCHAR2(100) not null,
username VARCHAR2(2000),
age VARCHAR2(100),
gender VARCHAR2(255),
address VARCHAR2(100)
)
tablespace TS_NAME
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 16K
next 8K
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table USER_T
add constraint USER_PK primary key (ID)
using index
tablespace TS_NAME
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
set sqlblanklines on
set feedback off
set define off
set serveroutput on
-- ---------------------------------------- USER_T ----------------------------------------
prompt create table USER_T ...
-- If the table is exists,drop it ...
DECLARE
v_table_exists number := 0;
BEGIN
select count(1) into v_table_exists
from user_tables t
where t.TABLE_NAME = 'USER_T';
dbms_output.put_line('USER_T v_table_exists: ' || v_table_exists);
if(v_table_exists > 0) then
execute immediate 'drop table USER_T';
end if;
END;
/
-- If the primary key is exists,drop it ...
DECLARE
v_pk_exists number := 0;
BEGIN
select count(1) into v_pk_exists
from USER_CONSTRAINTS t
where t.TABLE_NAME = 'USER_T' and t.CONSTRAINT_NAME = 'USER_PK';
dbms_output.put_line('USER_T v_pk_exists: ' || v_pk_exists);
if(v_pk_exists > 0) then
execute immediate 'alter table USER_T drop constraint USER_PK';
end if;
END;
/
-- Create table
create table USER_T
(
id VARCHAR2(100) not null,
username VARCHAR2(2000),
age VARCHAR2(100),
gender VARCHAR2(255),
address VARCHAR2(100)
)
tablespace TS_NAME
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 16K
next 8K
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table USER_T
add constraint USER_PK primary key (ID)
using index
tablespace TS_NAME
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
阅读全文
0 0
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 阿里云服务器和云虚拟主机的区别是什么?新手站长买哪个更好?
- [CDOJ1321]-区间DP(记忆化搜索)
- 圆圈倒计时
- 【nachos】山东大学操作系统课设实验nachos系统(1):线程初探
- 各种优化方法总结比较(sgd/momentum/Nesterov/adagrad/adadelta)
- 存储过程
- Codeforces 876 D. Sorting the Coins 模拟
- Solr6.3.0 embedde模式入库
- Java——BufferedReader和BufferedWriter应用实例
- LightOJ-1027DangerousMaze
- 清华张学工团队入选“人类细胞图谱计划”首批项目
- ROS中hokuyo激光雷达的安装和使用
- 一、ubuntu下tensorflow的安装。
- Git带你回到过去和未来【5】#合并、删除分支