Quote:
Originally posted by tompoes
Hello,
The primary key is generated from a different table.
I have made a function to get the next key, this key i use in my insert statement. these two steps are two transaction.
Know i want to make it in a different way, if the key is not filled in in the insert statement, then the before trigger fills it , with the same function as before.
But know it is one transaction, this is not what i want.
Because al the time is the key table locked.
Does someone know a soultion for this.
It has to work on Oracle,MSSql and Sybase.
Thanks
|
I think the solution is DBMS-dependent. For Oracle the correct approach is to use a SEQUENCE object; for MS SQL Server I think you normally use IDENTITY columns; probably Sybase is same as MS. Using a separate table to generate key values stinks as you can see, because to guarantee uniqueness you have to lock the table, which means only one person can insert a record at a time - which is no way for a serious database to work.