![](/img/trans.png)
[英]Oracle sqlplus execute sql script from command line while passing parameters to the sql script
[英]Oracle SQL script execution from command line
我創建了一個名為tabledeletion.sql的以下文件,它具有以下代碼:
declare
cnt_t int default null;
begin
select count(*) into cnt_t from user_tables where table_name = 'SPORT';
if cnt_t > 0 then
execute immediate 'drop table SPORT cascade constraints';
cnt_t := 0;
end if;
select count(*) into cnt_t from user_tables where table_name = 'VENUE';
if cnt_t > 0 then
execute immediate 'drop table VENUE cascade constraints';
cnt_t := 0;
end if;
我連接到Oracle 10g,並通過sql命令提示符輸入以下命令:
SQL> @tabledeletion
但是什么也沒發生。 為什么會這樣呢? 謝謝。
缺口
基於@Egor Skriptunoff的評論,我需要添加end;
和/
行到我的sql文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.