I am coming from the SQL server world where we had uniqueidentifier. Is there an equivalent in oracle? This column will be frequently queried so performance is the key.
CREATE table test (testguid RAW(16) default SYS_GUID() )
This blog studied the relative performance.
If I understand the question properly, you want to generate a unique id when you insert a row in the db.
You could use a sequence to do this. link here
Once you have created your sequence you can use it like this:
INSERT INTO mytable (col1, col2) VALUES (myseq.NEXTVAL, 'some other data');
GUIDs are not as used in Oracle as in MSSQL, we tend to have a NUMBER field (not null & primary key) , a sequence, and a trigger on insert to populate it (for every table).
The general practice using Oracle is to create an artificial key. This is a column defined as a number. It is populated via a sequence. It is indexed/constrained via a primary key definition.
There is no uniqueidentifier in Oracle.
You can implement one yourself by using RAW (kind of a pain) or CHAR. Performance on queries that JOIN on a CHAR field will suffer (maybe as much as 40%) in comparison with using an integer.
If you're doing distributed/replicated databases, the performance hit is worth it. Otherwise, just use an integer.
RAW(16) is apparently the preferred equivalent for the uniqueidentifier MS SQL type.