在PL SQL中如下的if嵌套语句对吗?该怎么写?

来源:百度知道 编辑:UC知道 时间:2024/05/31 16:20:22
if(1==1) then
if(0==0) then
a=b+c;
end if;
end if;

我是想两个if中的条件都满足才执行语句a=b+c;
请高手给看看,谢谢

注意写法是等号,不是双等号,其他的没有错误
begin
if(1=1) then
if(0=0) then
dbms_output.put_line('fsdafsd');
end if;
end if;
end;

output: fsdafsd

if(1=1) then
if(0=0) then
其他阿布要

你这样写是应该不对,等号只要一个,下面这个我测试过,你可以参考下:
IF (1 = 1 AND 0 = 0) SELECT getdate() AS a ELSE
SELECT 0 AS a

用case when ... then ... else ... end 是这样的:
select case when 1=1 and 0=0 then getdate() as a else 0 as a end

1=1和0=0都时永远成立的
你那么写可以的

类似if语句的功能,case when
你baidu一下他的用法就可以了

if(1=1) then
if(0=0) then
a=b+c;
end if;
end if;