Home » Developer & Programmer » Forms » How to generate sequence number through Developer 6i? (merged by LF)
How to generate sequence number through Developer 6i? (merged by LF) [message #260876] Tue, 21 August 2007 03:07 Go to next message
sams
Messages: 100
Registered: August 2007
Senior Member
i want to generate sequence number for a column in my table.i know how to do this in oracle but i want to do it in developer.

when i pass values to that table through developer interfaces,
..In one column that is primary key ,i want that automatically number generate.


can somebody help me
thnks

Re: how to generate sequence number through developer6i [message #260923 is a reply to message #260876] Tue, 21 August 2007 04:56 Go to previous messageGo to next message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

You can do it by two way.
First:-
Create a sequence and a trigger(before insert) for that table in the database and assign the sequence value using the before insert trigger.

Second:-
Through form add a trigger before insert in the block. add the field as hidden. assign the sequence number in the before insert trigger.

Cheers#
Sanka
Re: how to generate sequence number through developer6i [message #260975 is a reply to message #260876] Tue, 21 August 2007 07:12 Go to previous messageGo to next message
musman
Messages: 147
Registered: July 2007
Location: Lahore
Senior Member

select nvl(max(all_id),0)+1 into :allowence_type.all_id
from allowence_type;

-----------------------------------------------
At block level use this is PRE_INSERT trigger..

where all_id is databse field.
:allowance_type.all_id(blockname.item)
Re: how to generate sequence number through developer6i [message #261106 is a reply to message #260975] Tue, 21 August 2007 19:12 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You can also populate it in the 'when-create-record' trigger. It depends on whether you can tolerate 'holes' in the sequence in the table of stored records. Uuhh?? I'll explain. If you use the 'when-create-record' method and the user does NOT save the record, as the sequence number has been allocated and then not saved, it will become a 'hole'. However, if the user DEMANDS that the sequence number be visible on the screen then you will have the value from the 'get-go', which you wouldn't have if it wasn't populated until the 'pre-insert' fired as part of the 'commit' process.

David
sequence number in developer6i [message #261133 is a reply to message #260876] Tue, 21 August 2007 22:52 Go to previous messageGo to next message
sams
Messages: 100
Registered: August 2007
Senior Member
In oracle this code is used to generate sequence number::

create sequence message_msg_no
increment by 1
startwith 1
maxvalue 100
nocache
nocycle;


To call:

insert into message(msg_no,sender_id,
receiver_id,message,date,subject)
values (message_msg_no.NEXTVAL,'sara','nida','how r u?',
'23-jul-07','hi');


wat code for it in developer?
plz tell me
thnks
Re: sequence number in developer6i [message #261155 is a reply to message #261133] Wed, 22 August 2007 01:09 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The same.

Only, don't insert strings into DATE columns: '23-jul-07' is a string. Use TO_DATE('23-jul-07', 'dd-mon-yy') instead.
Re: how to generate sequence number through developer6i [message #261875 is a reply to message #260923] Thu, 23 August 2007 22:35 Go to previous message
sams
Messages: 100
Registered: August 2007
Senior Member
thank it's working
Previous Topic: TNSListener
Next Topic: TEXT FILE LOADING IN FORM
Goto Forum:
  


Current Time: Fri Sep 27 04:25:32 CDT 2024