if exists table drop table ORACLE 存储过程

前端之家收集整理的这篇文章主要介绍了if exists table drop table ORACLE 存储过程前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

CREATE OR REPLACE PROCEDURE DROPEXITSTABS
(TAB_NAME_IN IN varchar2) IS

v_cnt Number;
begin
select count(*)
into v_cnt
from user_tables
where table_name = upper(TAB_NAME_IN);

if v_cnt>0 then
execute immediate 'drop table ' || TAB_NAME_IN ||' purge';
end If;
end DROPEXITSTABS;

call DROPEXITSTABS('ZYWSPT-ZYWSSJJ');

create table "ZYWSPT-ZYWSSJJ" ( ID NUMBER(20) not null,ZBDM NVARCHAR2(20) null,NBBSF NVARCHAR2(30) null,SJYBSF NVARCHAR2(30) null,SJYMC NVARCHAR2(50) null,DY NVARCHAR2(200) null,SJLX NVARCHAR2(10) null,BSGS NVARCHAR2(10) null,YXZ NVARCHAR2(200) null,BZ NVARCHAR2(200) null,DLZ NVARCHAR2(20) null,DLSJ TIMESTAMP null,GXZ NVARCHAR2(20) null,GXSJ TIMESTAMP null,constraint "PK_ZYWSPT-ZYWSSJJ" primary key (ID) );

原文链接:https://www.f2er.com/oracle/212627.html

猜你在找的Oracle相关文章