Oracle创建表结构不报错脚本

Oracle创建表结构不报错脚本

DECLARE
  TOTAL INT := 0;
BEGIN
  SELECT COUNT(1)
    INTO TOTAL
    FROM USER_TABLES A
   WHERE A.TABLE_NAME = 'BASE_SERVICEPROVIDER';
  IF TOTAL > 0 THEN
    EXECUTE IMMEDIATE 'DROP TABLE BASE_SERVICEPROVIDER';
  END IF;
END;
/
create table BASE_SERVICEPROVIDER
(
  flagnum  VARCHAR2(8),
  flagdesc VARCHAR2(40),
  validind VARCHAR2(1)
)
tablespace TBLSPACE_REPORT
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
 
insert into BASE_SERVICEPROVIDER (FLAGNUM, FLAGDESC, VALIDIND)
values ('02', '公証行', '1');

insert into BASE_SERVICEPROVIDER (FLAGNUM, FLAGDESC, VALIDIND)
values ('01', '律师', '1');

insert into BASE_SERVICEPROVIDER (FLAGNUM, FLAGDESC, VALIDIND)
values ('03', '復康護理公司', '1');

commit;

你可能感兴趣的:(Oracle,oracle,数据库,sql)