Home » Developer & Programmer » Forms » serial field (oracle 8i forms 6i)
serial field [message #294819] Sat, 19 January 2008 09:36 Go to next message
akramrabaya
Messages: 41
Registered: November 2007
Member
i have a data block based on a database table " invoice " with
the following fileds (ser_no,item_code,qty,unit_price,total)

i want fileld ser_no to be generated automatically when ever i
insert any new record on that block

example

ser_no item_code qty unit_price total

1 , A/251 , 20 , 5 , 100

2 , b/251 , 10 , 10 , 100



so if i insert any new record between these 2 recored i want
the ser_no field to be adjusted automatically like this


ser_no item_code qty unit_price total

1 , A/251 , 20 , 5 , 100

2 , d/251 , 1 , 15 , 15

3 , b/251 , 10 , 10 , 100




best regards and thanks in advance

akram
Re: serial field [message #294822 is a reply to message #294819] Sat, 19 January 2008 12:09 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Are you using mutli-record block?
Does :SYSTEM.CURSOR_RECORD or :SYSTEM.TRIGGER_RECORD help you?

By
Vamsi
Re: serial field [message #294839 is a reply to message #294822] Sat, 19 January 2008 23:54 Go to previous messageGo to next message
akramrabaya
Messages: 41
Registered: November 2007
Member


am using multi-record block



akram
Re: serial field [message #294841 is a reply to message #294839] Sun, 20 January 2008 00:15 Go to previous messageGo to next message
akramrabaya
Messages: 41
Registered: November 2007
Member

sorry

i didn't answer the second part

:SYSTEM.CURSOR_RECORD or :SYSTEM.TRIGGER_RECORD is help but what i want is to adjust the whole block record not only the current record

1
2
3
4
5

if i delete the record no. 2 the ser_no filed become like this

1
3
4
5

!!! but i want it to be adjusted automatically to

1
2
3
4


thanks in advance
akram
Re: serial field [message #295238 is a reply to message #294841] Mon, 21 January 2008 19:26 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please rethink your design. Why do you need the row number in the record? It looks completely cosmetic. Just generate it during display and print by using 'rownum'.

David
Re: serial field [message #295280 is a reply to message #295238] Mon, 21 January 2008 23:55 Go to previous messageGo to next message
akramrabaya
Messages: 41
Registered: November 2007
Member


ok i need that field cuz i may use the same item_code more than
one time on the same invoice .. so it will not be enouph to use the item code only to access this record .. so i thought to have a ser_no field which will be always unique on the same invoice



akram

Re: serial field [message #295289 is a reply to message #295280] Tue, 22 January 2008 00:26 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So use Oracle object called SEQUENCE! It will provide uniqueness and yes, you'll get gaps, but who cares? Why would these ID's have to be consequent? It isn't beauty contest, it is a database.
Re: serial field [message #295596 is a reply to message #295280] Tue, 22 January 2008 19:17 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Use a sequence to make it unique in the database and use 'rownum' to make it LOOK unique when you display or print it.

David
Previous Topic: Out of Memory error on web.show_document
Next Topic: insert image in forms 10g
Goto Forum:
  


Current Time: Mon Mar 10 19:29:39 CDT 2025