Oracle__12. Oracle 1Z0-051 Exam - Sequence Objects Flashcards

1
Q

What is returned by this statement? CREATE SEQUENCE seq1 START WITH 100 INCREMENT BY 10 MAXVALUE 200 CYCLE NOCACHE; SELECT seq1.nextval FROM dual

A

1The first statement creates the sequence but does not have the MINVALUE so the sequences starts as 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can a Sequence Object be referenced in a CHECK constraint at a column level or table level?

A

Neither.A Sequence object cannot be used as a constraint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can a Sequence Object be referenced in a DEFAULT value?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What keyword from a SEQUENCE object refers to the last sequence number that has been generated?

A

CURRVAL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Are numbers generated from a sequence object only available for one table?

A

No.Sequence number are available to multiple tables or queries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens when the sequence object reached the MAXVALUE.

A

an additional request for a NEXTVAL will receive an error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What statement can be used to increase the maximum value of a Sequence object?

A

ALTER SEQUENCE sequencename MAXVALUE newvalue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What happens with sequence number if any are used in a transaction and the transactions is rolled back?

A

They are lost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the syntax to remove a sequence object from a database?

A

DROP SEQUENCE sequencename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens to a Sequence object when a table is dropped?

A

Nothing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the default minimum value of an ascending Sequence?

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the default sequence value of an ascending Sequence?

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What two references are used to retrieve information from a Sequence object?

A
  1. NEXTVAL2. CURRVAL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What 3 clauses can use a NEXTVAL or CURRVAL?

A
  1. SELECT2. VALUES of an INSERT3. SET of an UPDATE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What keyword added to a SELECT statement does not allow NEXTVAL or CURRVAL?

A

DISTINCT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Can a NEXTVAL or CURRVAL be used as a DEFAULT value in a CREATE statement?

A

No

17
Q

What clause added to a select statement does not allow NEXTVAL or CURRVAL?

A

GROUP BY

18
Q

Can NEXTVAL or CURRVAL be used in a Subquery?

A

No

19
Q

What 3 instances can a sequence have a gap in the numbers?

A
  1. roll back2. system crash3. same sequence is used on multiple tables
20
Q

How many values will oracle cache for a Sequence object?

A

20 values

21
Q

What is the primary use of the SEQUENCE object?

A

Primary keys

22
Q

What keyword in the CREATE SEQUENCE statement is not recommended if the Sequence is used for Primary keys?

A

CYCLE

23
Q

Between CYCLE and NOCYCLE what is the default value when creating a Sequence?

A

NOCYCLE

24
Q

What happens when a sequence reaches the MAXVALUE and the CYCLE values is set?

A

The sequence restarts at the MINVALUE

25
Q

The CYCLE and NOCYCLE are keyword for which database object?

A

SEQUENCE

26
Q

What happens to a sequence when the NEXTVAL reaches the MAXVALUE and the CYCLE option is specified?

A

The NEXTVAL becomes the MINVALUE