Additionally,
I have a function I call to get me a new key.
**Generates a unique number based on date and time and to use as a Primary Key
**Returns a Number: Should always be a ten digit number
FUNCTION GetKey
LOCAL cdatetime
CdateTime=str(recno())+str(seconds())+str(ROUND(RAND()*1000000000,0))
CdateTime=strtran(cdatetime,' ','')
nkey=ROUND(val(substr(CdateTime,1,10)),10)
RETURN nkey
If it's an insert I call this function and generate a key. Other wise I use the key in the where clause as Marfk stated.
It's faster than using Oracle Sequences and I use the same code for FoxPro;oracle SQL Server.
Instead of Identity columns and sequences. This gives me a new key.
Just thought I'd share that with you.
I have never ever had a duplicate key generated.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only