Home » RDBMS Server » Server Administration » sequence number
sequence number [message #372530] Tue, 20 February 2001 07:06 Go to next message
sheil
Messages: 1
Registered: February 2001
Junior Member
I want to base the primary key of a table on a sequence number. How can i do it and do i always need to retrieve the sequence from DUAL?
And how many possibilities are there?
Re: sequence number [message #372536 is a reply to message #372530] Tue, 20 February 2001 20:01 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
1.) From Mitch's earlier posting:
create or replace trigger t_bef_company
before insert
on company
fro each row
begin
select company_id_seq.nextval
into :new.company_id
from dual;
end;

2.) Insert into ABC values(my_seq.nextval, 1, "hello world", sysdate);

3.) insert into ABC (select my_seq.nextval, num_col, char_col, sysdate from MY_TAB);
Previous Topic: help needed in connect by clause
Next Topic: Re: Query its urgent
Goto Forum:
  


Current Time: Sat May 18 08:10:10 CDT 2024