同樣的oracle dll指令碼:
declare c int; begin
select count(*) into c from user_tables where table_name = upper('activestarttimes');if c = 1 then execute immediate 'drop table "activestarttimes" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('baseeventformat_classifiers');if c = 1 then execute immediate 'drop table "baseeventformat_classifiers" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('baseeventformat_payloadids');if c = 1 then execute immediate 'drop table "baseeventformat_payloadids" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('baseeventformat');if c = 1 then execute immediate 'drop table "baseeventformat" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('classifierbefmap');if c = 1 then execute immediate 'drop table "classifierbefmap" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('classifiergroups');if c = 1 then execute immediate 'drop table "classifiergroups" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('classifier');if c = 1 then execute immediate 'drop table "classifier" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('clquerymodel');if c = 1 then execute immediate 'drop table "clquerymodel" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('ecompid');if c = 1 then execute immediate 'drop table "ecompid" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('lggingpolicymessage_properties');if c = 1 then execute immediate 'drop table "lggingpolicymessage_properties" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('loggingpolicymessage');if c = 1 then execute immediate 'drop table "loggingpolicymessage" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('loggingpolicymodel_messages');if c = 1 then execute immediate 'drop table "loggingpolicymodel_messages" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('loggingpolicyproperty');if c = 1 then execute immediate 'drop table "loggingpolicyproperty" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('logservice');if c = 1 then execute immediate 'drop table "logservice" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('othersituation_any');if c = 1 then execute immediate 'drop table "othersituation_any" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('payloaddata');if c = 1 then execute immediate 'drop table "payloaddata" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('payload');if c = 1 then execute immediate 'drop table "payload" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('reportingcomponentid');if c = 1 then execute immediate 'drop table "reportingcomponentid" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('situationtype');if c = 1 then execute immediate 'drop table "situationtype" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('statsclassifiers');if c = 1 then execute immediate 'drop table "statsclassifiers" cascade constraints';c:=0;end if;
select count(*) into c from user_tables where table_name = upper('statsclassifiers');if c = 1 then execute immediate 'drop table "statsclassifiers" cascade constraints';c:=0;end if;
end;
在ant中執行出現錯誤如下
從錯誤上看是一行結尾沒有';', 可是檢查了一下, 每一行結尾, 還有檔案結尾的確都有';', 把指令碼放到dbvisualizer中執行沒有問題, 但在ant中執行為什麼會找不到呢?
在網上查了一下,原來ant預設使用分號來作為一條sql語句結束, 所以原來的儲存過程中的語句被分開執行了。我們希望sql仍做為整體執行, 可以將delimiter為"/"或其他符號(:= . ( @ % ; not之一), 這樣儲存過程中就沒有分隔符, sql語句可以作為整體執行了.
注意, 只有oracle需要這樣, 如果是sqlserver則不必加delimiter.當然加上也不會有問題.
vc 中,ado執行sql server儲存過程
variant t recordsaffected string szsql string p ks adduser m szname m szpasswd trycatch com error e catch com error e 必須指定執行sql語句的commandtype是adcmdsto...
Oracle執行引數化SQL語句和儲存過程
using system using system.collections.generic using system.text using system.data.oracleclient using system.data namespace oracleopdemo private static...
怎樣實現每天自動執行oracle的儲存過程一次
怎樣實現每天自動執行oracle的儲存過程一次 用job oracle定時器呼叫儲存過程 1.建立乙個表,為了能清楚看到定時器的運 況我們建立乙個帶有日期欄位的表 sql create table job table run time date www.2cto.com create table j...