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

what is the use of friend function? : Sql dba

0 Answers  


source destination distance chennai bangalore 500 bangalore chennai 500 hyd delhi 1000 delhi hyd 1000 bangalore hyd 800 Here chennai to bangalore and bangalore to chennai is same distance. and hyd and delhi also same criteria. Based on the distance i want to display only one row using sql query?

4 Answers   JPMorgan Chase,


What are properties of the transaction?

0 Answers  


how to load data with out header and footer records in a database using sql*loader? pls tell me the answer urgently

1 Answers   Oracle, Wipro,


What is a field in a database?

0 Answers  






What is the file extension for sql database?

0 Answers  


What is normalization? dec 2009

3 Answers   Cognizant,


What is oracle and pl sql?

0 Answers  


Explain aggregate functions are available there in sql?

0 Answers  


What does varchar include?

0 Answers  


how to escape special characters in sql statements? : Sql dba

0 Answers  


Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy

6 Answers   Target,


Categories