select count(*) into count from user_tables where table_name=UPPER(report_answer'); if count = 1 then execute immediate 'drop table report_answer'; end if;
加一句定义参数: declare table_count number; select count(*) into table_count from user_tables where table_name=UPPER(report_answer'); if table_count = 1 then execute immediate 'drop table report_answer'; end if;
if count = 1 then
execute immediate 'drop table report_answer';
end if;
skystar99047(天星) 的做法
行号= 19 列号= 4 错误文本= PLS-00204: 函数或伪列 'COUNT' 只能在 SQL 语句中使用
行号= 19 列号= 1 错误文本= PL/SQL: Statement ignoredcount我已经定义过了
count就是专门为了您写的语句定义的变量——如果不定义,回报错
所以我就定义了。
declare
table_count number;
select count(*) into table_count from user_tables where table_name=UPPER(report_answer');
if table_count = 1 then
execute immediate 'drop table report_answer';
end if;
漏了个'