HOW TO INCREMENT SERIAL NUMBER IN INSERT MODE [message #404952] |
Mon, 25 May 2009 13:13 |
orasql
Messages: 3 Registered: June 2007 Location: hyderabad
|
Junior Member |
|
|
dear friends,
i have an dispaly item which is serial num(sno)..when iam inserting 1st record sno is 1 as I initialized it to 1,after insertion of 1st record when cursor lands on sno item it should increment its value by 1...i.e,it should be 2,....how can i do that?
|
|
|
|
|
Re: HOW TO INCREMENT SERIAL NUMBER IN INSERT MODE [message #405158 is a reply to message #404962] |
Tue, 26 May 2009 11:46 |
orasql
Messages: 3 Registered: June 2007 Location: hyderabad
|
Junior Member |
|
|
hi everyone...
in my form i have multiple records..i have an display item
SNO in my form...in insert mode i want to increment its value by 1 for every record(in update mode i used rownum its workin).plzz help me .iam attaching the screenshot of that form.thanx in advance
|
|
|
Re: HOW TO INCREMENT SERIAL NUMBER IN INSERT MODE [message #405161 is a reply to message #404952] |
Tue, 26 May 2009 12:09 |
dsora
Messages: 24 Registered: May 2009
|
Junior Member |
|
|
For the moment, you can assign value to item in when-new-record-instance by checking system.mode (insert mode), increment it for every new record.
By using sequence:
you can make use of sequence (sql object).
Assign <sequence>.nextval to display item in pre-insert trigger.
not sure, you may need to use 'synchronize'.
|
|
|
Re: HOW TO INCREMENT SERIAL NUMBER IN INSERT MODE [message #405202 is a reply to message #404952] |
Tue, 26 May 2009 23:53 |
hisham99
Messages: 106 Registered: October 2008 Location: united arab emirates
|
Senior Member |
|
|
PROCEDURE seqno_prc(p_sourceblock IN VARCHAR2, p_sourcefield IN VARCHAR2) IS
v_currec NUMBER(4);
v_curfld VARCHAR2(50);
BEGIN
v_currec := :SYSTEM.CURSOR_RECORD;
v_curfld := :SYSTEM.CURSOR_FIELD;
LOOP
COPY(:SYSTEM.CURSOR_RECORD, p_sourceblock || '.' || p_sourcefield);
IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
EXIT;
END IF;
NEXT_RECORD;
END LOOP;
GO_RECORD(v_currec);
GO_FIELD(v_curfld);
END;
-----------------------
WHEN-NEW-RECORD-INSTANCE
BEGIN
If :SYSTEM.RECORD_STATUS in('NEW') THEN
--seqno_prc('block_name','item_name');
seqno_prc('dept','deptno');
END IF;
END;
|
|
|
|