扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共3页)
create table EmpTest ( empNo integer not null, lastName varchar2(30) not null, firstName varchar2(20) not null, job varchar2(9) ’ hireDate date ’ isActive number(1) constraint EmpTest_CK1 check (isActive in (0,1)) , salary number(9,2) , commision number(9,2) , deptNo number(2) , constraint EmpTest_PK primary key (empNo), constraint EmpTest_AK1 unique (lastName, firstName) ); create index EmpTest_HireDate_Salary on EmpTest ( salary, hireDate ); |
select index_name, index_type, uniqueness from user_indexes where table_name = ’EMPTEST’; |
索引名称 | 索引类型 | 唯一性 |
EMPTEST_AK1 | NORMAL | UNIQUE |
EMPTEST_HIREDATE_SALARY | NORMAL | NONUNIQUE |
EMPTEST_PK | NORMAL | UNIQUE |
约束名称 | 约束类型 | 索引名称 |
SYS_C002144065 | C | |
SYS_C002144066 | C | |
SYS_C002144067 | C | |
EMPTEST_CK1 | C | |
EMPTEST_PK | P | EMPTEST_PK |
EMPTEST_AK1 | U | EMPTEST_AK1 |
declare vClob clob; vLongString varchar2(32767); vOffSet pls_integer := 0; vLength pls_integer := 0; vTable varchar2(30) := ’EmpTest’; procedure Show (pVariable varchar2, pLineSize pls_integer := 80) is begin dbms_output.enable(1000000); if (length(pVariable) > pLineSize) then dbms_output.put_line(substr(pVariable, 1, pLineSize)); Show(substr(pVariable, pLineSize + 1), pLineSize); else dbms_output.put_line(pVariable); end if; end Show; begin -- 获取 DDL vClob := dbms_metadata.get_ddl(’TABLE’, upper(vTable)); -- 获取 CLOB 长度 vLength := dbms_lob.GetLength(vClob); dbms_output.put_line(’DDL length: ’ || to_char(vLength)); vOffSet := 1; dbms_lob.read(vClob, vLength, vOffSet, vLongString); -- 关闭 CLOB if (dbms_lob.isOpen(vClob) > 0) then dbms_lob.close(vClob); end if; Show(vLongString, 80); end; |
DDL length: 461 CREATE TABLE "BORIS"."EMPTEST" ( "EMPNO" NUMBER(*,0) NOT NULL ENABLE, "LASTNAME" VARCHAR2(30) NOT NULL ENABLE, "FIRSTNAME" VARCHAR2(20) NOT NULL ENABLE, "JOB" VARCHAR2(9), "HIREDATE" DATE, "ISACTIVE" NUMBER(1,0), "SALARY" NUMBER(9,2), "COMMISION" NUMBER(9,2), "DEPTNO" NUMBER(2,0), CONSTRAINT "EMPTEST_CK1" CHECK (isActive in (0,1)) ENABLE, CONSTRAINT "EMPTEST_PK" PRIMARY KEY ("EMPNO") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "TOOLS" ENABLE, CONSTRAINT "EMPTEST_AK1" UNIQUE ("LASTNAME", "FIRSTNAME") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "TOOLS" ENABLE) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "TOOLS" |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者