declare
num number;
begin
select nvl(max(1),0) into num from user_tables where table_name=...;
if num=0 then
..
else
存在;
end if;
end;
/
num number;
begin
select nvl(max(1),0) into num from user_tables where table_name=...;
if num=0 then
..
else
存在;
end if;
end;
/
nvl(max(1),0)是什么意思啊?
我只明白如果表不存在则返回0,存在的话是1!
不过请具体说明一下,谢谢!
nvl(max(1),0)的作用就是当表不存在时,实际会返回一个空值,但我们将他人为的改为0
类似用exists关键字