1. Create a sequence that will generate integers starting with the value 9. Each
ID: 3657130 • Letter: 1
Question
1. Create a sequence that will generate integers starting with the value 9. Each value should be three less than the previous value generated. The lowest possible value the sequence should be allowed to generate is -1, and it should not be allowed to cycle. Name the sequence MY_FIRST_SEQUENCE.
2. Issue a SELECT statement that will display NEXTVAL for MY_FIRST_SEQUENCE. Because the value is not being placed in a table, refernce the DUAL table in the FROM clause of the SELECT statement.
3. Issue a SELECT statement to display the CURRVAL for MY_FIRST_SEQUENCE. Because the value is not being placed in a table, reference the DUAL table in the FROM clause of the SELECT statement.
4. Reissue the SELECT statement from Assignment 2 five more times. Which values or messages does Oracle98i display for each execution of the SELECT statement?
5. Change the setting of MY_FIRST_SEQUENCE so the minimum value that can be generated is -1000.
6. Create a private synonym that will allow you to reference the MY_FIRST_SEQUENCE object as NUMGEN.
7. Use a SELECT statement to view the CURRVAL of NUMGEN.
8. Create an index on the CUSTOMERS table to speed up queries that search for customers based on their state of residence. Verify that the index exists, and then delete the index.
9. Delete the NUMGEN synonym.
10. Delete MY_FIRST_SEQUENCE.
Explanation / Answer
Your statement will be executed properly if you add MAXVALUE n, where n >= START_WITH_value. If it is not clear enough, here's an example: CREATE SEQUENCE my_seq START WITH 9 MAXVALUE 9 MINVALUE -1 INCREMENT BY -3; or CREATE SEQUENCE my_seq START WITH 9 MAXVALUE 1000 MINVALUE -1 INCREMENT BY -3; NOCYCLE is the default and it is not necessary to specify it.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.