if t.flag = 0 then update table t set t.flag = 1 ; elsif condition then --- esle --- end if;
我按照楼上写了一个例子运行,if t.POOL_DELETED_FLAG = 0 then update apm_emp_pool_tbl t set t.POOL_DELETED_FLAG = 1; end if;但是报错: ORA-00900 invalid SQL statementCause: The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.请问什么原因?Procedural Option 是不是存储过程的啊 ,怎么 install?
if ... end if是PL/SQL, 报错原因是非法SQL, 你在SQL环境下写PL/SQL, 当然非法啦, SQL环境下只能用 case... when... , 没if的
在 pl/sql developer sql window 中declare cursor c_flag is select flag from table ; begin for cc in c_flag loop if (cc.flag=0) then update table set flag=1 ; end if; end loop; commit; end ; /个人感觉sql中用 decode 或 case 好些!!
请在if ...end if 前后加在begin end; begin if thne end if; end;
update table t set t.flag = 1 ;
elsif condition then
---
esle
---
end if;
update apm_emp_pool_tbl t set t.POOL_DELETED_FLAG = 1;
end if;但是报错:
ORA-00900 invalid SQL statementCause: The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.请问什么原因?Procedural Option 是不是存储过程的啊 ,怎么 install?
SQL环境下只能用 case... when... , 没if的
cursor c_flag is select flag from table ;
begin
for cc in c_flag loop
if (cc.flag=0) then
update table set flag=1 ;
end if;
end loop;
commit;
end ;
/个人感觉sql中用 decode 或 case 好些!!
begin
if thne
end if;
end;
where t.flag=0;
if thne
end if;
end;