Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to Increment the value of a feild sequentillay in a multi-record block ?
Hello:
A few days back I had posted the following question to our list,
but I could get no replies to my question. So I had to break my head on my
own and find a solution for that. I could find not one but two solutions:
Ist Soultion
The eample is built on a form with EMP block.
In the Trigger
when-new-block-instance (Emp Block)
:Global.currdate := '';
In the Trigger
when-new-record-instance (Emp Block)
If :Hiredate is not null and :Global.currdate is null then
If :System.last_record <> 'True' then
last_record;
:Global.currdate := to_char(:hiredate,'dd-mon-yyyy');
End if;
End if;
In the Trigger (hiredate Item)
when-new-item-instance
IF :System.Record_Status IN ('CHANGED','INSERT') THEN
IF :hiredate is null then
:hiredate := Add_months(to_date(:Global.currdate,'DD-Mon-YYYY'),1);
:Global.currdate := to_char(:hiredate,'dd-mon-yyyy');
end if;
end if;
IInd Solution : -
We can do the same thing by defining a when-new-rcord-instance trigger and
a when-new-block instance trigger and using a loop to increment the value of
a global variable.
Hope this helps others who face a similar situation in future.
Regards,
Faiz
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: FAIZ QURESHI INET: faizq_at_hotmail.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Sat May 17 2003 - 04:36:39 CDT