nvl review
Peggy, March 14, 2002 - 1:11 pm UTC
This looks like what I was looking for. This should work great. thanks.
A question related but with case.-
Mariano, April 22, 2005 - 8:47 am UTC
Hi Tom,
sorry for bother you with a question I guess has an easy answer but I've trying to solve it for a few hours and I guess I just can't see where the problem is:
create table accounts
(
acc_id number,
wrong_tries number,
account_blocked char(1)
);
insert into accounts values (1291, 0, 'N');
declare
max_wrong_tries number := 3;
begin
update accounts acc set acc.wrong_tries=acc.wrong_tries+1,
case when max_wrong_tries <= acc.wrong_tries+1 then
acc.account_blocked='Y' end
where acc.acc_id=1291;
commit work;
end;
/
When I run it this is the output:
case when max_wrong_tries <= acc.wrong_tries+1 then
*
ERROR at line 5:
ORA-06550: line 5, column 9:
PL/SQL: ORA-00927: missing equal sign
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored
Can you please be so kind to tell me what I'm missing?
Regards,
Mariano.-
April 22, 2005 - 10:40 am UTC
update accounts
set wrong_tries = wrong_tries+1,
account_blocked = case when wrong_tries+1 >= L_max_wrong_tries
then 'Y'
else account_blocked
end
where acc_id = ....;
suggest you prefix ALL plsql variables, to differentiate them from columns.
Related to the last post.-
Mariano, April 22, 2005 - 8:48 am UTC
Forget to tell you I'm working with 10.1.0.
Sorry.
Mariano.-