How to apply the generated sequence on the tables?

Showing Answers 1 - 7 of 7 Answers

Dinesh

  • Apr 10th, 2006
 

Hi, If u r having sequence name is dept_seq

create seqeunce dept_seq

start with 10

increment by 10

no chache

no cycle

Then u can use this sequence like this

insert into dept(deptno, dname, loc)  values(dept_seq.nextval, <any dname>, <any location name>

try this one..

Regards

Dinesh

Dear friend :
  oracle generate sequence numbers with the help of predefined function called nextval.

so if you want insert these generated sequence no you can do using <seq_name>.nextval

for eg:
let us say we have the following table:
sample:
x number,
y varchar2(20)

we can generate like this:
create sequence seq_sam start with 1 increment by 1
/
insert into sample values(seq_sam.nextval,'sdsdsf')
/

so you can use like that.............


  Was this answer useful?  Yes

gcvpgeek

  • Mar 16th, 2009
 

Say you are using the seq name temp_seq

CREATE SEQUENCE temp_seq
Start with 5
Increment by 2
maxvalue 999999999999999999999999
nocache
nocycle

Above will create the sequence temp_seq
To use it
INSERT INOT xyz
VALUES (temp_seq.nextval,'oracle')

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions