What is CYCLE/NO CYCLE in a Sequence?

Answers were Sorted based on User's Feedback



What is CYCLE/NO CYCLE in a Sequence?..

Answer / tulsi

NO CYCLE is default when sequence is created

CYCLE statement is given when the sequence has to repeat
its number generation between START WITH and MAX VALUE.

Is This Answer Correct ?    8 Yes 0 No

What is CYCLE/NO CYCLE in a Sequence?..

Answer / gvmahesh

NOCYCLE keyword is default in sequences.

CYCLE :If we want use cycle keyword first we check the table
having primary key or not.If there is no primary key we
absolutely use the CYCLE keyword.

In hierarchical structure,the descendant act as a
ancestor,is called CYCLE.

For eliminating ancestor descendant problem we use NOCYCLE
KEYWORD.

for example we take the EMP table

In EMP table the MGR column has a NULL managerial number.In
that column we insert some of the empno.Then ancestor
descendant problem occur.

select * from emp;

update emp set mgr=7566 where mgr is null;

Then we write a hierarchical query

select empno,ename,sal,mgr from emp
start with ename='KING'
connect by prior empno=mgr;

we execute this query it shows an error

ERROR:
ORA-01436: CONNECT BY loop in user data.

in this situation also we want to see the data through
NOCYCLE keyword.

select empno,ename,sal,mgr from emp
start with ename='KING'
connect by NOCYCLE prior empno=mgr;

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

How can I change database name in sql?

0 Answers  


How to get employee name from employee table which is the fiveth highest salary of the table

20 Answers   Infosys, Rolta,


what are enums used for in mysql? : Sql dba

0 Answers  


What is sql clause?

0 Answers  


table structure: ---------------- col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10 01-mar-2012 11:12:46 01-mar-2012 11:11:23 Write a query to display the result as shown below: col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10

2 Answers  






How to call DDL statements from pl/sql?

5 Answers  


what is explain plan?, given an example...

3 Answers   Polaris,


What is nosql vs sql?

0 Answers  


write a qurey for finding the length of the sting.

6 Answers   Infosys, TCS,


what is a composite primary key ? : Sql dba

0 Answers  


What is a sql trace file?

0 Answers  


how to rename an existing column in a table? : Sql dba

0 Answers  


Categories