2014-02-08 51 views
0

我創建以下文件名爲tabledeletion.sql,它有下面的代碼:從命令行的Oracle 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 

但沒有任何反應。這是爲什麼發生?謝謝。

尼克

+3

將'end;'和'/'行附加到您的.sql文件 –

+1

謝謝@EgorSkriptunoff。這工作。請讓您的評論成爲答案,以便將其標記爲解決方案。 –

回答

0

基於@Egor Skriptunoff的評論,我需要end;/行添加到我的SQL文件。

+0

你能分享完整的SQL文件嗎? –