Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AUTO NUMBER???

Status
Not open for further replies.

Apprentice101

IS-IT--Management
Aug 16, 2004
66
US
I have a child (detail) block in tubular form. I need to have a field that will number the regults after the master is queried. ie.

MASTER = company
details= employees

details block looks like this:


NUMBER | NAME | LAST_NAME |ADDRESS
1
2
3
4

so I need that for every record on the detail block, a number is generated. So if a new employee gets inserted for this compay, the field "Number" created 5. by the same token if a company has 2, then the next time someone gets inserted they receive 3 ans so on.

can you guys please help me with this? I dont even know where to start.
thanks!
 
Can you use a sequence on PRE-INSERT that starts with your highest existing number plus one?

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
Author and Sole Proprietor of: Emu Products Plus
 
well, that would mean to have a sequence for each master record wouldnt ?
 
Yes, if you want each company to have employees with the same number. If that is the case your PRE-INSERT will have to query the detail table and find the max employee ID for that company and add one.

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
Author and Sole Proprietor of: Emu Products Plus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top