Home » Developer & Programmer » Forms » Auto Generated Record (Oracle Form6i, Database 9 -windows 2003)
Auto Generated Record [message #318009] Mon, 05 May 2008 05:36 Go to next message
kamran.it
Messages: 265
Registered: September 2005
Location: Karachi
Senior Member
HI

I am using master and detail block. master in form and detial in tabular.
in MAster block it is working proerply but in detail block. I want that check the max no from detail block and add+1 with the row, if I inserted in detail 5 row that will generate recored accrodingly.

like. max(srno) = 5
I inserted 5 more record in detail
then replace with 6,7,8,9,10 like that.
see my following code.


I used the following code in detail block when create record
declare
v_sr number(4):=0;
begin
select max(ojobno) into v_sr from sub_fabric_rec ;

if v_sr is not null or v_sr<>0 then

:sub_fabric_rec.ojobno:= v_sr + :SYSTEM.cursor_record;

else
:sub_fabric_rec.ojobno:=1;
end if;

exception
when no_data_found then
:sub_fabric_rec.ojobno:=1;
end;



it is working but if I inserted 5 record in detail block first 2 rows Auto No are same??
and after 2nd row other reocords working accrodingly.

like
16
16
17
18
19
20 etc
Re: Auto Generated Record [message #318013 is a reply to message #318009] Mon, 05 May 2008 05:50 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What happens if you modify it to
:sub_fabric_rec.ojobno:= v_sr + :SYSTEM.cursor_record + 1;
(I didn't test it; these are just my first thoughts about the issue)
Re: Auto Generated Record [message #318016 is a reply to message #318013] Mon, 05 May 2008 05:56 Go to previous messageGo to next message
kamran.it
Messages: 265
Registered: September 2005
Location: Karachi
Senior Member
It is working same but at first 2 rows increament 2 instead of 1.
Re: Auto Generated Record [message #318023 is a reply to message #318016] Mon, 05 May 2008 06:35 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I have created a dummy form (based on Scott's 'dept' table), used your trigger but couldn't simulate two equal numbers in first two records.

However: as :system.cursor_record = 0 at the beginning, could you change it to :SYSTEM.TRIGGER_RECORD instead (as its value is 1, not 0)?

Or, even better, attach a FMB file (possibly based on Scott's schema; if not, include CREATE TABLE and INSERT INTO sample records) so that we could test what's happening.
Re: Auto Generated Record [message #318210 is a reply to message #318023] Tue, 06 May 2008 02:11 Go to previous message
kamran.it
Messages: 265
Registered: September 2005
Location: Karachi
Senior Member
Thank you
I changed trigger
when-validate-item now working.
Previous Topic: ORA-12514 Error in Oracle Forms
Next Topic: PL\SQL LIBRARIES
Goto Forum:
  


Current Time: Sat Dec 03 04:06:36 CST 2016

Total time taken to generate the page: 0.04824 seconds