IF condition problem in pre-update trigger [message #521909] |
Sun, 04 September 2011 00:23 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/9fc2c55773e60a8cef395fa8cb47a31f?s=64&d=mm&r=g) |
goparaju
Messages: 54 Registered: June 2011
|
Member |
|
|
Hi Experts,
I am working in 6i. I have a datablock A.
DATA BLOCK A: concession, status, date(read only).
Requirement: If the status not in ('open','in process'), i want to assign sysdate to date column, otherwise, no sysdate assignment to date column. I am using below logic to achieve.
PRE-UPDATE TRIGGER:
IF :blockA.status not in ('open','in process') THEN
:blockA.date:=sysdate;
END IF;
But irrespective of above if condition, it's assigning sysdate to date column, could somebody help me why it's going wrong.
Kindly help.
|
|
|
|
|
|
|
Re: IF condition problem in pre-update trigger [message #521976 is a reply to message #521945] |
Mon, 05 September 2011 05:15 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
cookie monster, i believe that the requirement is stated as :
Quote:
Requirement: If the status not in ('open','in process'), i want to assign sysdate to date column, otherwise, no sysdate assignment to date column. I am using below logic to achieve.
so isnt the above piece of code fullfil the requirement ?
|
|
|
|
|
|
|
Re: IF condition problem in pre-update trigger [message #522086 is a reply to message #522027] |
Tue, 06 September 2011 07:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
goparaju wrote on Mon, 05 September 2011 22:49Hi,
Thanks for your replies. Below code is working for me.
if lower(:blocka.status) not in ('open','in process') then
:blocka.date := sysdate;
else
:blocka.date := null;
end if;
Thanks.
welcome,
i beleive it was due to logical error,
since the user once set the status to open or in process
and then afterwards change the status, and since upn change of status u were not setting the date column to null, hte old value remained there...
|
|
|
|