Re: (very Urgent)How will I generate Database independent Unique ids for setting the primary keys?
Posted By:
Holly_Wyman
Posted On:
Saturday, February 16, 2002 06:03 AM
Hy Eldo,
you might use the remote ip address and the system time in milliseconds and convert them into a String. I usually do so when implementing my own Session-classes.
Holly
Re: (very Urgent)How will I generate Database independent Unique ids for setting the primary keys?
Posted By:
Marc_Flament
Posted On:
Friday, November 23, 2001 06:24 AM
Use the CREATE SEQUENCE statement to create a sequence, which is a database object from which multiple users may generate unique integers. You can use sequences to automatically generate primary key values.
You can create a sequence with :
CREATE SEQUENCE
schema.your_sequence_name start with 1
increment by 1;
to select the next id from this sequence :
select your_sequence_name.NEXTVAL from DUAL;
or to select the current val :
select your_sequence_name.CURRVAL from DUAL;
you can use next id directly in your insert statement
insert EMPLOYEE(ID,NAME)values(your_sequence_name.NEXTVAL,"JOHNN");
or you can use it a WHERE clause too.
Good luck.