Home » Developer & Programmer » Forms » Still not solve auto generate Transaction # (10g,Developer 6I,Window XP)
icon1.gif  Still not solve auto generate Transaction # [message #383328] Wed, 28 January 2009 05:41 Go to next message
shahzaib_4vip@hotmail.com
Messages: 410
Registered: December 2008
Location: karachi
Senior Member
Well

I am still unknown how to generate a simple transaction # like 1 then 2 then 3 on oracle form

Like i alter a emp table and add column transaction# now i want to auto generate transaction no when ever i enter new record in emp table


Thanks


Shahzaib ismail
Re: Still not solve auto generate Transaction # [message #383329 is a reply to message #383328] Wed, 28 January 2009 05:48 Go to previous messageGo to next message
mkhalil
Messages: 108
Registered: July 2006
Location: NWFP Peshawar Pakistan
Senior Member
Create block level pre-insert trigger write the following code.
select nvl(max(empno),0)+1 into :blockname.itemname from emp;

Hope it will solve your problem.

Muhammad Khalil
Re: Still not solve auto generate Transaction # [message #383332 is a reply to message #383329] Wed, 28 January 2009 05:52 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It would work, of course. Only, it might (probably will) cause problems in multi-user environment because it might happen that two (or more) users will fetch the same max(empno) so you'd get two (or more) equal values.

A sequence (Oracle database object) is by far the easiest way to implement such a requirement.
Re: Still not solve auto generate Transaction # [message #383348 is a reply to message #383328] Wed, 28 January 2009 06:45 Go to previous messageGo to next message
shahzaib_4vip@hotmail.com
Messages: 410
Registered: December 2008
Location: karachi
Senior Member
@ Little Foot

I am still unaware how to use sequence

do you have any example or do you share a simple fmb file

Hope you will help me


Thanks

Shahzaib
Re: Still not solve auto generate Transaction # [message #383349 is a reply to message #383348] Wed, 28 January 2009 06:51 Go to previous message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Learn how to use Forum Search engine; it reveals many information.

Here is an example of how to use a sequence in a form.
Previous Topic: ORA-01008 with pipelined function
Next Topic: Using WebCam
Goto Forum:
  


Current Time: Wed Dec 11 23:02:30 CST 2024